Steganography- Hide Your Files Inside An Image in Linux

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 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, 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.

  • LinuxSytesNet

    Yesterday watched a movie with Morgan Freeman called ‘ A long came a spider ‘ and must say that I was quite impressed how they exchanged encrypted messages hidden in pictures. Thank you for the tutorial :)

  • zinovsky

    Yes, it is possible using Steganography, we will post another quick howto do that in the next few days

  • jet li

    i try the method, and i unzip the image contain zip secret, i dont find the file that i was hide, where it go? and how to open it? :s

  • DragonFartOutLoud

    it went to china.

  • jacky can

    You can actually unzip your secret archive by leaving out the -t option, instead using:

    unzip newPhoto.jpg

  • Pat L

    I tried it and it works with a regular zip file, but if you password-protect the .zip file it does NOT work.

  • piCool

    Great ! we have another another master trick :-)

  • Paulo Renato Xavier da Silva

    We can do this (or something similar) with a regular folder?

  • hackyogi

    How To Hide Folders and files inside Jpeg files in Windows Check out here

  • poketoo

    add a truecrypt file container and it fixes that problem… it goes jpg > zip (unprotected)>truecrypt container (pwd protected)> text file (or whatever you wanted to hide)

  • AlphaThinker

    No offense, but this method is almost useless. Steganography is intended to hide the existence of (encrypted) data. A zip file appended to a jpg file can be easily detected. With a little analysis you can easily understand that the jpg file has some extra information at the end, and you can recognize the header of a zip file after the normal jpeg data (even if the zip file is encrypted). Sorry, but proper steganography is little more tricky.

  • Pingback: پسور گذاری وقفل گذاری روی یک پوشه خاص()