Steganography: Hide text within an Image file using steghide

Today we will be looking on how we can hide important texts in an Image file. This method of concealing texts inside an Image is known as Steganography. But the concept is not new. However only the people in computer security are aware of this method. And it can be really helpful in multiple situations. Let us look at how we can use steganography to hide any text inside an image file using steghide.

Quick Navigation

What is Steganography ?

Before we dive in to the actual technical bits. Let me provide you some basic background on the Steganography.

Steganography is a practice of concealing important data in an image, audio, video or similar files. The important data can be any other file that you want to hide.

The data might be stored in the lowest bits that are noisy areas of the targeted file. The word noisy here means the often unwanted and subtle areas of the file.

Because if the major areas of the files are targeted the file will be completely unusable. If you want to learn more about it google is your best friend.

Also Read : Learning about encrypting files & folders on Ubuntu

TECHENUM

Why would you use Steganography ?

Now that we know what Steganography, why would we want to use it ?

You would use this way of hiding to make the secure data less obvious. If you add some data in an image file which was your holiday visit.

No one would really notice anything right off the bat. Because it’s just your vacation image. Or maybe you want to store your sensitive information.

We need to use a utility named steghide available on Linux to hide our data using Steganography. Let us look at how.

What is steghide ?

steghide is a command line utility available on *nix like platforms. It allows us to hide textual contents inside supported image file.

Note that I have mentioned supported image files. As this tool cannot append data on to a PNG file but JPG works just fine. Which is good enough for tricking the prying eyes in general.

steghide steganography options

At the time of writing this article version 0.5.1 is in use. And we are going to look ate each of the parameters in this utility.

Also Read : 5 Productivity Tips and Tricks for Ubuntu

TECHENUM

How to hide text using steghide ?

Let us finally see how we can actually hide our super confidential text using steghide.

The very first step is to create a text file containing the confidential text. For this I have written something in a file named such_confidential.txt.

steghide steganography preparation

You might notice the lunch has a typo. But nuclear is just the name of a restaurant nearby.

We also have a image file named not_sketchy_at_all.jpg. We will be storing the contents of the text file in this image file.

Run the command below to encrypt and append the data. You will be asked to type a password twice.

steghide embed -cf <image_file> -ef <file_with_confidential_text>Code language: Bash (bash)

The -cf option is short for --coverfile which specifies the targeted image file. Whereas the -ef option is short for --embedfile which is the file which needs to be hidden.

In case of this blog post is the command shown in the image below.

That’s it, if you open the image you will not see any text but it is there. It’s secure from everyone even if you freely distribute it.

It’s safe as long as no one knows its there. And as long as you have a strong passphrase.

The command will also save the name of the file from where the data was taken. Which will help restore the original file name when we extract the data from the image. Which we will see in the next section.

Also Read : Learn Interesting Uses of ‘ls’ command in Linux

TECHENUM

How to extract hidden text using steghide ?

Now that we have appended our text in the file in the section above. Let us see how we can actually retrieve the file from the image.

If we look at the folder where we have the image file we can see only the image file exist.

Now that we have the file let us run the command below to extract the data from the image file. It will prompt for password which you have used to encrypt the text.

steghide extract -sf <image_file>Code language: Bash (bash)

The option -sf is short for --stegfile which is the file which holds the appended data.

And when we use the utility. We will have the following output for this blog post example.

And once we list the directory again we will see both files in the directory. We have our original file name with same contents. which is shown in the image below

We have successfully extracted the encrypted information from the image.

If you want to extract the data to a separate file you can do that by using the -xffile_name.txt which is short for --extractfile file_name.txt option.

steghide extract -sf <image_file> -xf target_file.txtCode language: Bash (bash)

Also Read : Password 101: You are overlooking your own security

TECHENUM

But wait, there’s more

If you are really advance user you can do something more with this utility.

You can pass in the encryption algorithm to be used for the input file. You can do that with the command -e or –encryption. Let us look at an example of the command.

steghide embed -cf <image_file> -ef <file_with_confidential_text> -e serpentCode language: Bash (bash)

As you can see that we have used the serpent algorithm. But you can use any algorithms available.

For a list of available algorithms run the utility with command below.

steghide --encinfoCode language: Bash (bash)

Which will output something like the list below. You can use the available algorithms as you wish.

So that was how you can use the steganography method to hide the text inside image using steghide.

Related Posts