Steganography - Hiding text files in images files

In my previous tutorial, I covered concealing messages in text files. Now, I’m going to show you how to conceal a text file in an image file using steghide, since SNOW only allows to store data in ASCII files. Like SNOW, steghide is a command-line program (I believe there is a GUI version available).

Steghide’s official website states the following:

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.

It’s worth noting that this program is a bit more complex than SNOW, so I will only be covering the essential options. So without further ado, let’s get started!


Installing steghide

Just like SNOW, steghide’s repositories are already present in Kali, so to install simply type
sudo apt-get install steghide


Concealing text files in image files

Like I said earlier, i’ll cover the essential options of the program, so if you want the full list of options just type in the terminal:

steghide or steghide --help

The main options we’ll take a look at are:

  embed - embed data
  extract - extract data
  -ef - file to be embedded
  -cf - cover-file (image/audio file)
  -sf - stego-file
  -xf - write the extracted data to <filename>

Let’s imagine I want to share a secret file named “wordlist” and conceal it in an image file called “Robin.JPG” (To my understanding, only .jpg files work). I’d type:

steghide embed -ef wordlist -cf Robin.JPG

Now the program will ask you to setup a passphrase (just type whatever you want).


Retreiving the concealed file

To retrieve the hidden file, we type:

steghide extract -sf Robin.JPG -xf <some_file_name>

It’ll ask you again for the passphrase. Now all you need to do is find the file with the extracted data and you’re good to go!


That’s it for this tutorial, hope you enjoyed reading as much as I did writing it!

11 Likes

Great post! I also like to use Pixelknot when I’m on Android

2 Likes

Thanks! I’ve heard of it, but I actually never tried it.

I’ve always wondered about combining stenography and cryptography.

What if you hid encrypted data in the noisy parts of an image? How predictable is the noise in a typical image file anyway?

I suppose certain types of images would have a much higher entropy value. For a start, high quality images, and probably images of complex objects rather than, say, a wall.

1 Like

Talk about old posts…

I see you’re into crypto but I gotta be honest, unfortunately, it’s not something I know a lot about, so I can’t really help you with that question, maybe some other person can help you (and I’m sure they will).

This post was just a quick how-to on Steganography.

Steganography involves cryptography, otherwise, your hidden data will decrease the entropy which, compared to the standard, will lead to its detection.

This method is known as DCT steganography. Here is a paper about this process.

Disclaimer: I didn’t read it, but it will certainly explain DCT algorithm.

The entropy is correlated to the maximal compression ration. Lower is the ratio, higher will be the entrepropy. Consequently, whatever the image is, a high quality or not, it is the file format that will affect the entropy.

jpeg > png > bmp

Further reading about entropy:

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.