Home

Awesome

Steganography Toolkit

This project is a Docker image useful for solving Steganography challenges as those you can find at CTF platforms like hackthebox.eu. The image comes pre-installed with many popular tools (see list below) and several screening scripts you can use check simple things (for instance, run check_jpg.sh image.jpg to get a report for a JPG file).

Docker build status

Hack The Box

Usage

First make sure you have Docker installed (how to). Then you can use the shell scripts bin/build.sh and bin/run.sh in this repo to build the image and run the container. You will be dropped into a bash shell inside the container. It will have the data folder mounted, into which you can put the files to analyze.

If you don't use the scripts, follow these steps:

  1. Build image (docker build -t <image_name> .) or pull from Docker hub (docker pull dominicbreuker/stego-toolkit)
  2. Start a container with your files mounted to the folder /data (docker run -it <image_name> -v /local/folder/with/data:/data /bin/bash)
  3. Use CLI tools and screening scripts on your files: e.g., run check_jpg.sh image.jpg to create a quick report, or run brute_jpg.sh image.jpg wordlist.txt to try extracting hidden data with various tools and passwords
  4. If you want to run GUI tools use one of these two ways:

Check out the following sections for more information:

Demo

Start with docker run -it --rm -v $(pwd)/data:/data dominicbreuker/stego-toolkit /bin/bash. You will be dropped into a container shell in work dir /data. Your host folder $(pwd)/data will be mounted and the images inside will be accessible.

animated demo gif

Tools

Many different Linux and Windows tools are installed. Windows tools are supported with Wine. Some tools can be used on the command line while others require GUI support!

Command line interface tools

These tools can be used on the command line. All you have to do is start a container and mount the steganography files you want to check.

General screening tools

Tools to run in the beginning. Allow you to get a broad idea of what you are dealing with.

ToolDescriptionHow to use
fileCheck out what kind of file you havefile stego.jpg
exiftoolCheck out metadata of media filesexiftool stego.jpg
binwalkCheck out if other files are embedded/appendedbinwalk stego.jpg
stringsCheck out if there are interesting readable characters in the filestrings stego.jpg
foremostCarve out embedded/appended filesforemost stego.jpg
pngcheckGet details on a PNG file (or find out is is actually something else)pngcheck stego.png
identifyGraphicMagick tool to check what kind of image a file is. Checks also if image is corrupted.identify -verbose stego.jpg
ffmpegffmpeg can be used to check integrity of audio files and let it report infos and errorsffmpeg -v info -i stego.mp3 -f null - to recode the file and throw away the result

Tools detecting steganography

Tools designed to detect steganography in files. Mostly perform statistical tests. They will reveal hidden messages only in simple cases. However, they may provide hints what to look for if they find interesting irregularities.

ToolFile typesDescriptionHow to use
stegoVeritasImages (JPG, PNG, GIF, TIFF, BMP)A wide variety of simple and advanced checks. Check out stegoveritas.py -h. Checks metadata, creates many transformed images and saves them to a directory, Brute forces LSB, ...stegoveritas.py stego.jpg to run all checks
zstegImages (PNG, BMP)Detects various LSB stego, also openstego and the Camouflage toolzsteg -a stego.jpg to run all checks
stegdetectImages (JPG)Performs statistical tests to find if a stego tool was used (jsteg, outguess, jphide, ...). Check out man stegdetect for details.stegdetect stego.jpg
stegbreakImages (JPG)Brute force cracker for JPG images. Claims it can crack outguess, jphide and jsteg.stegbreak -t o -f wordlist.txt stego.jpg, use -t o for outguess, -t p for jphide or -t j for jsteg

Tools actually doing steganography

Tools you can use to hide messages and reveal them afterwards. Some encrypt the messages before hiding them. If they do, they require a password. If you have a hint what kind of tool was used or what password might be right, try these tools. Some tools are supported by the brute force scripts available in this Docker image.

ToolFile typesDescriptionHow to hideHow to recover
AudioStegoAudio (MP3 / WAV)Details on how it works are in this blog posthideme cover.mp3 secret.txt && mv ./output.mp3 stego.mp3hideme stego.mp3 -f && cat output.txt
jphide/jpseekImage (JPG)Pretty old tool from here. Here, the version from here is installed since the original one crashed all the time. It prompts for a passphrase interactively!jphide cover.jpg stego.jpg secret.txtjpseek stego.jpg output.txt
jstegImage (JPG)LSB stego tool. Does not encrypt the message.jsteg hide cover.jpg secret.txt stego.jpgjsteg reveal cover.jpg output.txt
mp3stegoAudio (MP3)Old program. Encrypts and then hides a message (3DES encryption!). Windows tool running in Wine. Requires WAV input (may throw errors for certain WAV files. what works for me is e.g.: ffmpeg -i audio.mp3 -flags bitexact audio.wav). Important: use absolute path only!mp3stego-encode -E secret.txt -P password /path/to/cover.wav /path/to/stego.mp3mp3stego-decode -X -P password /path/to/stego.mp3 /path/to/out.pcm /path/to/out.txt
openstegoImages (PNG)Various LSB stego algorithms (check out this blog). Still maintained.openstego embed -mf secret.txt -cf cover.png -p password -sf stego.pngopenstego extract -sf openstego.png -p abcd -xf output.txt (leave out -xf to create file with original name!)
outguessImages (JPG)Uses "redundant bits" to hide data. Comes in two versions: old=outguess-0.13 taken from here and new=outguess from the package repos. To recover, you must use the one used for hiding.outguess -k password -d secret.txt cover.jpg stego.jpgoutguess -r -k password stego.jpg output.txt
spectrologyAudio (WAV)Encodes an image in the spectrogram of an audio file.TODOUse GUI tool sonic-visualiser
steganoImages (PNG)Hides data with various (LSB-based) methods. Provides also some screening tools.stegano-lsb hide --input cover.jpg -f secret.txt -e UTF-8 --output stego.png or stegano-red hide --input cover.png -m "secret msg" --output stego.png or stegano-lsb-set hide --input cover.png -f secret.txt -e UTF-8 -g $GENERATOR --output stego.png for various generators (stegano-lsb-set list-generators)stegano-lsb reveal -i stego.png -e UTF-8 -o output.txt or stegano-red reveal -i stego.png or stegano-lsb-set reveal -i stego.png -e UTF-8 -g $GENERATOR -o output.txt
SteghideImages (JPG, BMP) and Audio (WAV, AU)Versatile and mature tool to encrypt and hide data.steghide embed -f -ef secret.txt -cf cover.jpg -p password -sf stego.jpgsteghide extract -sf stego.jpg -p password -xf output.txt
cloackedpixelImages (PNG)LSB stego tool for imagescloackedpixel hide cover.jpg secret.txt password creates cover.jpg-stego.pngcloackedpixel extract cover.jpg-stego.png output.txt password
LSBStegImages (PNG, BMP, ...) in uncompressed formatsSimple LSB tools with very nice and readable Python codeLSBSteg encode -i cover.png -o stego.png -f secret.txtLSBSteg decode -i stego.png -o output.txt
f5Images (JPG)F5 Steganographic Algorithm with detailed info on the processf5 -t e -i cover.jpg -o stego.jpg -d 'secret message'f5 -t x -i stego.jpg 1> output.txt
stegpyImages (PNG, GIF, BMP, WebP) and Audio (WAV)Simple steganography program based on the LSB methodstegpy secret.jpg cover.pngstegpy _cover.png

Steganography GUI tools

All tools below have graphical user interfaces and cannot be used through the command line. To run them, you must make an X11 server available inside the container. Two ways are supported:

Alternatively, find other ways to make X11 available inside the container. Many different ways are possible (e.g., mount UNIX sockets).

ToolFile typesDescriptionHow to start
StegImages (JPG, TIFF, PNG, BMP)Handles many file types and implements different methodssteg
Steganabara (The original link is broken)Images (???)Interactively transform images until you find somethingsteganabara
StegsolveImages (???)Interactively transform images, view color schemes separately, ...stegsolve
SonicVisualiserAudio (???)Visualizing audio files in waveform, display spectrograms, ...sonic-visualiser
StegosuiteImages (JPG, GIF, BMP)Can encrypt and hide data in images. Actively developed.stegosuite
OpenPuffImages, Audio, Video (many formats)Sophisticated tool with long history. Still maintained. Windows tool running in wine.openpuff
DeepSoundAudio (MP3, WAV)Audio stego tool trusted by Mr. Robot himself. Windows tool running in wine (very hacky, requires VNC and runs in virtual desktop, MP3 broken due to missing DLL!)deepsound only in VNC session
cloackedpixel-analyseImages (PNG)LSB stego visualization for PNGs - use it to detect suspiciously random LSB values in images (values close to 0.5 may indicate encrypted data is embedded)cloackedpixel-analyse image.png

Screening scripts

Many tools above do not require interaction with a GUI. Therefore, you can easily automate some workflows to do basic screening of files potentially containing hidden messages. Since the applicable tools differ by filet type, each file type has different scripts.

For each file type, there are two kinds of scripts:

The following file types are supported:

Wordlist generation

The brute forcing scripts above need wordlists. Imho it will very likely not help to use huge standard wordlists like rockyou. The scripts are too slow for it and stego challenges seem to not be designed for this. A more probable scenario is that you have a hunch what the password could be but you do not know exactly.

For these cases, several tools to generate wordlists are included:

Steganography examples

The image contains a sample image and audio file each in different formats:

It also contains a script /examples/create_examples.sh which you can run to embed a hidden message ("This is a very secret message!") into these files with many different methods. After running this script, you find these files in /examples/stego-files with their names indicating which tool was used to embed the message. You can run the screening scripts to see if they find anything on them or try to break them otherwise.

GUI and Containers

By default, no GUI tools can be run in a Docker container as no X11 server is available. To run them, you must change that. What is required to do so depends on your host machine. If you:

Use X11 forwarding through SSH if you want to go this way. Run start_ssh inside the container to start the server, make sure you expose port 22 when starting the container: docker run -p 127.0.0.1:22:22 ..., then use ssh -X ... when connecting (the script prints the password).

To not depend on X11, the image comes with a TigerVNC server and noVNC client. You can use it to open an HTML5 VNC session with your browser to connect to the containers Xfce desktop. To to that, run start_vnc.sh inside the container to start server and client, make sure you expose port 6901 when starting the container docker run -p 127.0.0.1:6901:6901 ... and go to localhost:6901/?password=<the_password> (the script prints the password).

Using SSH with X11 forwarding

animated demo gif - SSH + X11

Commands in the GIF for copy & paste:

# in 1st host shell
docker run -it --rm -p 127.0.0.1:22:22 dominicbreuker/stego-toolkit /bin/bash

# inside container shell
start_ssh.sh

# in 2nd host shell (use it to launch GUI apps afterwards)
ssh -X -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@localhost

Using Browser and VNC

animated demo gif - Browser + VNC

Commands in the GIF for copy & paste:

# in 1st host shell
docker run -it --rm -p 127.0.0.1:6901:6901 dominicbreuker/stego-toolkit /bin/bash

# inside container shell
start_vnc.sh

# in browser, connect with: http://localhost:6901/?password=<password_from_start_vnc>

Link collection

This is a collection of useful Steganography links:

References

The following example media files are included in this repository: