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 preinstalled with many popular (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 this JPG file).
bin/run.shin 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
datafolder mounted, into which you can put the files to analyze.
- Build image (
docker build -t <image_name> .) or pull from Docker hub (
docker pull dominicbreuker/stego-toolkit)
- Start a container with your files mounted to the folder
docker run -it <image_name> -v /local/folder/with/data:/data /bin/bash)
- Use CLI tools and screening scripts on your files: e.g., run
check_jpg.sh image.jpgto create a quick report, or run
brute_jpg.sh image.jpg wordlist.txtto try extracting hidden data with various tools and passwords
- If you want to run GUI tools use one of these two ways:
start_ssh.shand connect to your container with X11 forwarding
start_vnc.shand connect to the container’s Desktop through your browser
Check out the following sections for more information:
- What tools are installed? Go here
- What scripts can I run to quickly screen files automatically or brute force them? Go here
- How can I play with different Steganography examples to see if I can break them? Go here
- How can I run GUI tools inside the container? go here
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.
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.
|Tool||Description||How to use|
|file||Check out what kind of file you have||
|exiftool||Check out metadata of media files||
|binwalk||Check out if other files are embedded/appended||
|strings||Check out if there are interesting readable characters in the file||
|foremost||Carve out embedded/appended files||
|pngcheck||Get details on a PNG file (or find out is is actually something else)||
|identify||GraphicMagick tool to check what kind of image a file is. Checks also if image is corrupted.||
|ffmpeg||ffmpeg can be used to check integrity of audio files and let it report infos and errors||
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.
|Tool||File types||Description||How to use|
|stegoVeritas||Images (JPG, PNG, GIF, TIFF, BMP)||A wide variety of simple and advanced checks. Check out
|zsteg||Images (PNG, BMP)||Detects various LSB stego, also openstego and the Camouflage tool||
|stegdetect||Images (JPG)||Performs statistical tests to find if a stego tool was used (jsteg, outguess, jphide, …). Check out
|stegbreak||Images (JPG)||Brute force cracker for JPG images. Claims it can crack
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.
|Tool||File types||Description||How to hide||How to recover|
|AudioStego||Audio (MP3 / WAV)||Details on how it works are in this blog post||
|jphide/jpseek||Image (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!||
|jsteg||Image (JPG)||LSB stego tool. Does not encrypt the message.||
|mp3stego||Audio (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.:
|openstego||Images (PNG)||Various LSB stego algorithms (check out this blog). Still maintained.||
|outguess||Images (JPG)||Uses “redundant bits” to hide data. Comes in two versions: old=
|spectrology||Audio (WAV)||Encodes an image in the spectrogram of an audio file.||
||Use GUI tool
|stegano||Images (PNG)||Hides data with various (LSB-based) methods. Provides also some screening tools.||
|Steghide||Images (JPG, BMP) and Audio (WAV, AU)||Versatile and mature tool to encrypt and hide data.||
|cloackedpixel||Images (PNG)||LSB stego tool for images||
|LSBSteg||Images (PNG, BMP, …) in uncompressed formats||Simple LSB tools with very nice and readable Python code||
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:
start_ssh.shto fire up an SSH server. Connect afterwards with X11 forwarding. Requires an X11 server on your host!
start_vnc.shto fire up a VNC server + client. Connect afterwards with your browser to port 6901 and you get an Xfce desktop. No host dependencies!
Alternatively, find other ways to make X11 available inside the container. Many different ways are possible (e.g., mount UNIX sockets).
|Tool||File types||Description||How to start|
|Steg||Images (JPG, TIFF, PNG, BMP)||Handles many file types and implements different methods||
|Steganabara (The original link is broken)||Images (???)||Interactively transform images until you find somethinf||
|Stegsolve||Images (???)||Interactively transform images, view color schemes separately, …||
|SonicVisualiser||Audio (???)||Visualizing audio files in waveform, display spectrograms, …||
|Stegosuite||Images (JPG, GIF, BMP)||Can encrypt and hide data in images. Actively developed.||
|OpenPuff||Images, Audio, Video (many formats)||Sophisticated tool with long history. Still maintained. Windows tool running in wine.||
|DeepSound||Audio (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!)||
|cloackedpixel-analyse||Images (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)||
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:
XXX_check.sh <stego-file>: runs basic screening tools and creates a report (+ possibly a directory with reports in files)
XXX_brute.sh <stego-file> <wordlist>: tries to extract a hidden message from a stego file with various tools using a wordlist (
crunchare installed to generate lists – keep them small).
The following filetypes are supported:
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:
- john: the community enhanced version of John the Ripper can expand your wordlists. Create a base wordlist with a few candidate passwords and use
johnto create many variants of them. Use
john -wordlist:/path/to/your/wordlist -rules:Single -stdout > /path/to/expanded/wordlistto apply extensive rules (~x1000)
john -wordlist:/path/to/your/wordlist -rules:Wordlist -stdout > /path/to/expanded/wordlistfor a reduced ruleset (~x50).
- crunch: can generate small wordlists if you have a pattern in mind. For instance, if you know the passwords ends with 1984 and is 6 letters long, use
crunch 6 6 abcdefghijklmnopqrstuvwxyz -t @@1984will generate the 26 * 26 = 676 passwords aa1984, ab1984, … up to zz1984. The format is
crunch <min-length> <max-length> <charset> <options>and we used the templating option. Check out
less /usr/share/crunch/charset.lstto see the charsets crunch ships with.
- CeWL: can generate wordlists if you know a website is related to a password. For instance, run
cewl -d 0 -m 8 https://en.wikipedia.org/wiki/Donald_Trumpif you suspect a picture of Donald Trump contains an encrypted hidden message. The command scrapes the site and extracts strings at least 8 characters long.
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:
- run on Linux, you probably have X11
- run on Mac OS, you need Xquartz (
brew install Xquartz)
- run on Windows, you have a problem
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
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
# in 2nd host shell (use it to launch GUI apps afterwards)
ssh -X -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [email protected]
Using Browser and 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
# in browser, connect with: http://localhost:6901/?password=<password_from_start_vnc>
This is a collection of useful Steganography links:
- You must be able to spot codes. Check out this cheat sheet from Eric Harshbarger, which contains many different codes.
- Cheatsheet describing workflows, things to look for and common tools: click
- Forensics CTF guide with lots of ideas for stego challenges: click
- File format descriptions as beautiful posters: click
The following example media files are included in this repository:
- Demo image (JPG, PNG): https://pixabay.com/p-1685092
- Demo sound file (MP3, WAV): https://upload.wikimedia.org/wikipedia/commons/c/c5/Auphonic-wikimedia-test-stereo.ogg — By debuglevel (Own work) [CC BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons