binwalk
toolsbeginner
Use binwalk to find and extract embedded files, firmware, and hidden data in CTF forensics and steganography challenges.
toolsbinwalkforensicssteganographyfirmwareextractionfile-analysis
binwalk
binwalk scans binary files for embedded file signatures, compressed data, and filesystem images. It's one of the first tools to run on any unknown file in CTF forensics and steganography challenges.
Analysis Decision Tree
Installation
sudo apt install binwalk
# Or latest:
pip3 install binwalkCore Operations
binwalk file.bin # Scan for signatures
binwalk -B file.bin # Explicit signature scan (same as default)
binwalk *.bin # Scan multiple files
# Example output:
# DECIMAL HEXADECIMAL DESCRIPTION
# 0 0x0 PNG image, 512 x 512
# 1234 0x4D2 Zip archive data, "flag.txt"
# 5678 0x162E gzip compressed dataBinwalk Workflow Visualization
Binwalk helps identify file signatures and nested archives within binary data.
Systematic Analysis Workflow
Basic file identification
file suspicious.* # check actual file type
xxd suspicious.* | head -20 # inspect magic bytes
strings suspicious.* | head -50 # quick string checkRun binwalk scan
binwalk suspicious.*Read all signatures. Multiple hits (e.g., PNG + Zip + gzip) indicate embedded content.
Extract and explore
binwalk -Me suspicious.*
ls -la _suspicious.*/
find _suspicious.*/ -type f | sortCheck filenames, especially anything containing "flag", "secret", or unusual extensions.
Entropy analysis for encrypted/hidden data
binwalk -E suspicious.*High-entropy region after a valid file structure = appended encrypted archive. Note the offset and carve manually if needed.
Manual carving (if binwalk misses it)
# Extract bytes from offset 1234 to end:
dd if=suspicious.bin of=carved.zip bs=1 skip=1234
unzip carved.zipFormat-Specific Notes
Checklist
-
binwalk file- scan before anything else -
binwalk -Me file- recursive extract if anything found -
binwalk -E file- entropy graph for hidden/encrypted regions - Check
_file.extracted/for nested archives -
strings file | grep -i flag- quick win - For images: also run
zsteg(PNG) orsteghide(JPEG) - Manual
ddcarve when binwalk misses known magic bytes
Last updated on