Hiding Files Inside An Image in Linux


 

I have a previous post on how to hide files inside an image file in Windows. If you have not read or watched the video yet, it is right here.

Anyway, a comment on that post gave a tip on how to do the same thing on Linux. Of course I tried it and it worked! According to Sebastian of mathemaniac.org, the concept here is really simple. An image file like JPG is read from the beginning of the file and terminated with an ‘End of Image’ marker. An archive file like ZIP has their metadata stored at the end of the file. Put them together and the image will be read as a valid image file and the appended ZIP file will be read as an archive.

Here is how to do it in Linux:

Get an image file and an archive of the files that you want to hide. In this example, I have cat beer_and_cig.jpg and hideme.zip file. The zip file contains an MP3 song that I have stored inside the archive. To create the archive-image file, run this command:

cat beer_and_cig.jpg hideme.zip > ucantseeme.jpg

What this does is the ‘cat‘ command reads the image file first, then reads the zip file and puts them together in the file named ucantseeme.jpg.

To test the integrity of the image file, try this:

# unzip -t ucantseeme.jpg
Archive: ucantseeme.jpg
warning [ucantseeme.jpg]: 4751 extra bytes at beginning or within zipfile
(attempting to process anyway)
testing: Feist - 09 - One Two Three Four.mp3 OK
No errors detected in compressed data of ucantseeme.jpg.

Notice the warning message? The test saw that there were few bytes at the beginning, which means it saw the image file first but the archive is intact and no errors were found.

Perfect!

 

Advertisements

One response to this post.

  1. Posted by nbiser on June 5, 2013 at 5:26 pm

    Thanks!

    Reply

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s