Aug
14

Hide Files Inside An Image File

Did you know that you can hide files inside an image file like jpeg? A simple image when opened or previewed looks like an innocent JPEG or any image file, but when uncompressed using any archiving software, it extracts files that were hidden from plain view.

However, in this video, Windows was used. I have yet to discover if this is possible in Linux.

Related Posts

3 Comments to “Hide Files Inside An Image File”

  • Sebastian Paaske Tørholm Windows XP Mozilla Firefox 3.0.1 August 15, 2008 at 12:26 am

    The reason it works is pretty simple:

    What you’re doing is basically taking the contents from both files, the jpeg and the zip and dumping them into one big file.

    JPEGs are read from the beginning of the file, and they are terminated with an “End of Image” marker. This means you can append anything to the end of a valid JPEG and it’ll still be a perfectly valid JPEG and work in any image editor.

    ZIPs, on the other hand, have their metadata stored at the end of the file as relative positions. What this means is, you can append a ZIP file to any other file and it’ll still be a perfectly valid ZIP file.

    Thus if you append a ZIP file to a JPEG file, it’ll be both a valid JPEG and a valid ZIP file.

    To test that out, try following the guide and storing something inside an image. You can either name it secret.jpg and see it as a picture with the data hidden, or name it secret.zip and see it as an archive with the picture hidden.

    Doing it on linux is no challenge, you simply do a:
    cat image.jpg data.zip > secretimage.jpg
    (“cat” is the *nix equivalent of the Windows “type” command.)

    (I used to mess around a bit with this a while back. I believe it works with GIF, too.)

    Sebastian Paaske Tørholm’s last blog post is A few things you should know about your favorite video sites.

  • Rai Linux Mozilla Firefox 3.0.1 August 17, 2008 at 10:09 am

    That worked perfectly in my Linux box!

    Thanks for the tip, Sebastian :) *hug*

  • Tip: Hiding Files Inside An Image in Linux | PinoyTux Weblog WordPress 2.5.1 August 17, 2008 at 10:34 am

    [...] 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. [...]

Post comment

CommentLuv Enabled