Geekblok

B10m, BOK, Joffie - old geeks on a blog

Entries Comments



Hiding files in JPEGs

4 December, 2007 (12:19) | guides, images | By: B10m

You’ve probably heard about storing secret messages in JPEGs by means of steganography. But what if you have entire documents that you’d like to hide? As proof of concept, I showed this example to my coworkers.

We start out with a random JPEG, taken from my Flickr account:

fotobok.jpg

Now we create a simple zip file with a text document in it:

$ zip test.zip test.txt

And we cat the two files together:

$ cat fotobok.jpg test.zip > fotobok-test.jpg

File indeed recognizes this as an image:

$ file fotobok-test.jpg
fotobok-test.jpg: JPEG image data, JFIF standard 1.01

And you can see it here too:

fotobok-test.jpg

The only difference now is that we can unzip the file aswell:

$ unzip fotobok-test.jpg
Archive: fotobok-test.jpg

warning [fotobok-test.jpg]: 19881 extra bytes at beginning or within zipfile

(attempting to process anyway)

extracting: test.txt

Tada! Our highly secret test.txt is back!