October 21, 2020

Black Cyber Space

Everything you need to know! The World Wide Web

thumb_23400_default_td_480x480

How to hide data in an image (Kali/Linux)

What is Steganography?
Steganography is the practice of concealing a file, message, image, or video within another file, message, image, or video. Generally, the hidden messages appear to be (or be part of) something else: images, articles, shopping lists, or some other cover text. You can pretty much use the same method to hide data in Audio or Video files.

In digital steganography, electronic communications may include steganographic coding inside of a transport layer, such as a document file, image file, program or protocol. Media files are ideal for steganographic transmission because of their large size. For example, a sender might start with an innocuous image file and adjust the color of every 100th pixel to correspond to a letter in the alphabet, a change so subtle that someone not specifically looking for it is unlikely to notice it.

The advantage of steganography over cryptography alone is that the intended secret message does not attract attention to itself as an object of scrutiny. Plainly visible encrypted messages—no matter how unbreakable—arouse interest, and may in themselves be incriminating in countries where encryption is illegal. Thus, whereas cryptography is the practice of protecting the contents of a message alone, steganography is concerned with concealing the fact that a secret message is being sent, as well as concealing the contents of the message.

Steganography in Kali Linux
There are a couple of tools available in Kali for this purposes. In this Tutorial we are using Steghide.

Steghide
Steghide is a steganography program that is able to hide data in various kinds of image- and audio-files. The color- respectivly sample-frequencies are not changed thus making the embedding resistant against first-order statistical tests.

Features:
compression of embedded data
encryption of embedded data
embedding of a checksum to verify the integrity of the extraced data
support for JPEG, BMP, WAV and AU files

1. Installing Steghide

Code root@kali:~# apt-get install steghide
Very difficult? Hehe

2. Hide text file in Image
I created a folder steghide in root home folder and placed picture.jpg and secret.txt file in there. picture.jpg is the file where I am going to hide secret.txt file. I am going to show the commands here.

To hide text file in Image in Kali Linux using steghide, use the following command:

Code root@kali:~/steghide# steghide embed -cf picture.jpg -ef secret.txt
Enter passphrase:
Re-Enter passphrase:
embedding "secret.txt" in "picture.jpg"... done
root@kali:~/steghide#

This command will embed the file secret.txt in the cover file picture.jpg.
Now you can email, share or do anything with this new picture.jpg file without having to worry about exposing your data.

3. Extracting text file from Image
If you have received a file that contains embedded data and you want to get some information about it before extracting it, use the info command:

Code root@kali:~/steghide# steghide info picture.jpg
"picture.jpg":
format: jpeg
capacity: 3.1 KB
Try to get information about embedded data ? (y/n) y
Enter passphrase:
embedded file "secret.txt":
   size: 6.5 KB
   encrypted: rijndael-128, cbc
   compressed: yes
root@kali:~/steghide#


After printing some general information about the stego file (format, capacity) you will be asked if steghide should try to get information about the embedded data. If you answer with yes you have to supply a passphrase.
Steghide will then try to extract the embedded data with that passphrase and – if it succeeds – print some information about it.