
Steganography of this type is usually not scored very highly but is decently widespread. Binwalk is an immensely useful tool which automatically detects and extracts files hidden with steganography tools CTF Example SolvingĪlthough it is possible and at times practical to solve these tasks using linux tools like dd, there are some tools that make it much easier. If you are presented with an image and no instructions, your safest bet is that is has something hidden after the closing tags of the image. These challenges are usually presented as a simple picture with no other instructions, and it is up to the competitor to run it through a hex editor to find out if it involves steganography. In the Solving section more concise and efficient methods are described. This is the long way of solving a simple steganography problem but shows how the strategy works.
#ONLINE HEX EDITOR FROM IMAGE ZIP FILE#
When this completes you should have a zip file you can easily unzip to access the text file inside. This takes in the image example.jpg, the 'in file' if, reads one block at a time, 'block size' bs, skips to block 1972141, skip, and writes it to the 'out file' zip we call foo.zip. We know where the location of the zip file is, but dd only takes decimal values, so we convert the hexadecimal location 0x01e17ad from hex to decimal to get 1972141.ĭd if=example.jpg bs=1 skip=1972141 of=foo.zip In our case, we are going to be using it to extract the zip file. The dd command is very versatile and allows for the copying and converting of a multitude of files. Using this information we can use another handy linux tool, dd). PK are the initials of Phil Katz, the inventor of the zip file, and indicate that a zip file starts at that point. Near the bottom of the file you should see the terminating byte of a jpg ffd9:Ġ1e17a0: 685c 7fab 8eb4 5b32 61f1 c4ff d950 4b03 h\.[2a.PK.Īnother important part of this line is the PK near the end.

Open up the image in your favorite hex editor and start looking around for something odd (You may find the flag itself from the dump at this point, but for the sake of example try extracting it). If you save it to your computer and open it up with an image viewer, you should be presented with a simple jpg image. ExampleĪ very simple implementation of this strategy is used in the example.jpg file in this directory.

These bytes are sometimes hard to find in a sea of numbers though, so looking at the dump of the hex (the text representing the hex bytes) can also help you find hidden. The image viewer that you use will use the information between these bytes to present an image to you, ignoring anything after the terminating byte.įor example, The terminating byte for a JPEG is FF D9 in hex, so using a hex viewer ( xxd is good for linux, or something like HxD for windows) you can find out where the image finishes. The reason this works is because when an image file is read it has starting and ending bytes dictating the size of the image. The file will open normally as an image but will also hold hidden files inside, commonly zip, text, and even other image files. One of the most common steganography tricks is to hide a file inside of an image.
