Steganography- Hide Your Files Inside An Image in Linux

Nowadays, our  personal computer is not only a work tool,  it is also our private space where we store our little secrets.   Protecting our  personal data from praying eyes should be one of our top  priorities.   People use  cryptography or encryption to  hide their data, but they forget that cryptography  does not hide  data from  a third party, its goal is to make your data unreadable by a third party.

 This is a big mistake that a lot of people make when they try to hide and  protect their data from the  praying eyes. I think this happens because they never heard about Steganography, the science  of  hiding information. In this article i will not discuss what  steganography is in detail because it is not the purpose of this article but i will teach you how to hide your files inside an image. It sounds ‘sexy’, doesn’t it ? This method makes your data transferring more secure and it will make hard  for third parties to understand  what  really you are transferring if they sniff your traffic. What  do you need in order to  hide your files inside an image ?  Ok, you need a  JPG image file, your files and a terminal window.  The files i will use for this article are shown in Figure 1.

Figure 1

How to hide files inside the image ?

Before going further, create a zip archive of your files and open a new terminal window like shown in Figure 2.

Figure 2

Now it is clear that we want to hide  secret_files.zip inside 9080221.010.1M.jpg image. We will use the Linux cat command  which has different functions like displaying files, creating new ones and combining copies of them. The cat command will read the images file first, secret_files.zip and we will concatenate them   together.   After you have opened the terminal change directory to the  directory  where you have your files, mine are inside  Desktop/articles, so i type cd Desktop/articles in my terminal and press Enter.

Figure 3

Make sure all the files are inside the directory by using the ls command  which stands for listing all files and subdirectories inside a directory and copy your filenames inside a text document because you will need them in the next command.  Time to hide my zip archive inside my image.

Figure 4

Simple Explanation of the command in Figure 4

  1. cat reads the image file
  2. cat reads the zip file
  3. cat  concatenates the image and the zip file togeather  in a new file, bugatti.jpg ( You can put any name you like)

It is the time to give our story a happy ending. Press Enter and a new  file will be created. The new file is bugatti.jpg which  looks like a regular image file but if we try to operate with unzip command on it ,  the unzip command will extract  the zip archive that is inside the image.

After you have  typed the command  as shown in Figure 4 press  Enter  on your keyboard and the new  file will be created, called bugatti.jpg.

Figure 5

The ls command  lists all files inside my article directory and it shows a new file, bugatti.jpg.

Figure 6

The file that is important to us is bugatti.jpg  because  our secret files are inside this image so feel completely free to delete other files when you  use this method. It looks like a normal jpeg file and it will open as an image, but when you use unzip command to operate on it, it will  show us a message like shown in Figure 7.

Figure 7

Hehehe! Surprised ? Maybe not if you knew before about this method, but if you are a  newbie to linux and Steganography  you  will enjoy it to the fullest and will fall in love with this method when it comes to choosing methods  for hiding your private files. I love this method, because it is simple and a very good way to hide my personal data.