Welcome to part three in a series about steganography, the art of hiding things in plain sight. We are practicing steganography because it can be a useful skill if you don't have access to encryption software, or need a quick solution to make sure the sender and recipient are the only ones who are able to read your message.
In this Null Byte, we are going to learn how to hide messages and photos inside image files. This means that the hidden bits will literally be in the photo and viewable once the picture is altered in some kind of photo editing software. It works by removing the least significant parts of the picture and swapping them out. If done right, the change is unnoticeable to the human eye.
For the tutorial, we will be using a free alternative to Adobe Photoshop—GIMP (GNU Image Manipulation Program). And this can be done under any OS platform. I'm using Arch Linux.
Step 1 Download/Install GIMP and Find an Image
First, let's get the necessary software. All commands in bold are entered into a terminal emulator. This is not necessary for Windows users.
- Download GIMP from their website.
- Extract the package. cmd:
tar zxvf <package-name>
- Do the usual Linux install procedure. cmd:
./configure && make && sudo make install
- Find an image to embed the message into.
Step 2 Hiding an Image within an Image
Lets modify the image we've selected in GIMP.
- Open your image in GIMP.
- Click Windows > Dockable Dialogs > Palettes. The image quality should degrade.
- Add a new Palette by clicking the blank document icon on the lower-left.
- Add 8 new colors by right clicking and bringing them from the foreground.
- Colors in order: ff0000:00ff00:0000ff:ffff00:ff00ff:00ffff:ffffff:000000
- Click Image > Mode > Indexed. Use our palette.
- Click Windows > Dockable Dialogs > Colormap.
- Change every color's FF to 02. The image should be almost black.
- Now click Image > Mode > RGB.
- Open a second image, and paste the first image we made into it.
- On the GIMP toolbar, anchor the image and select Difference from the mode menu.
- Click on Image > Flatten Image.
- Save as an uncompressed PNG file.
To view the image, open it up in GIMP and just turn the contrast levels up and down until you find a "sweet spot" that allows you to see the hidden image underneath.
Step 3 Hiding Text in an Image
To see how to modify an image with hidden text, follow along with me in the video tutorial below. This should also help with any questions from the image method above, as they follow the same principals.
For viewing the text within the image, it's the same process as viewing the hidden image. Just mess with the contrast until you find the sweet spot that allows you to read the text.
Want to start making money as a white hat hacker? Jump-start your white-hat hacking career with our 2020 Premium Ethical Hacking Certification Training Bundle from the new Null Byte Shop and get over 60 hours of training from ethical hacking professionals.