binwalk-extract
What it does
This guide covers unpacking firmware images into their file systems so they can be reviewed. It is for security analysts working with firmware they are authorized to examine.
When to use it
- βWhen you have a raw firmware image that needs its file system extracted for review.
- βWhen a firmware image seems to contain compressed or encrypted regions and you need to tell them apart.
- βWhen a firmware image uses a non-standard file system format that needs special tools.
Skill link
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/iot/binwalk-extract/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βI have a firmware image from one of our devices. Can you unpack it and tell me what is in the file system?β
5 new skills a week. 1 minute to read.
How it works
The agent scans the image for known file signatures, measures entropy to spot compressed or encrypted areas, and extracts the readable file systems.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Firmware Extraction with binwalk
Turn a raw binary image into a navigable filesystem tree. binwalk handles most common containers; firmware-mod-kit covers special-case squashfs variants; manual mounting handles the rest.
Prerequisites
- Raw firmware binary (from
firmware-acquisitionskill). - Tools:
binwalk(β₯ 2.3),sasquatch(non-standard squashfs decompressor),jefferson(JFFS2 extractor),ubireader(UBI/UBIFS),mtd-utils,firmware-mod-kit(FMK),7-zip,lzma,xz-utils.
# Kali / Debian install
sudo apt-get install -y binwalk firmware-mod-kit mtd-utils
pip3 install jefferson ubireader
# sasquatch (handles non-standard squashfs compression: LZMA, XZ, ZLIB with vendor patches)
git clone https://github.com/devttys0/sasquatch && cd sasquatch
./build.sh && sudo cp sasquatch /usr/local/bin/
Step 1 β Identify + Entropy Survey
FW=/workspace/evidence/iot/<target>/firmware/flash_full.bin
# Quick filetype + offset scan
binwalk "$FW"
# Entropy analysis: flat line near 1.0 = encrypted/compressed; structured = filesystem
binwalk -E "$FW"
# Output plot to PNG for report
binwalk -E --save "$FW" # saves <fw>.png beside the binary
# High entropy region with no signature = encrypted blob β note offset + size
# Low-to-medium entropy with known FS signature = squashfs/jffs2/cramfs β extract
Reading the entropy graph
| Entropy range | Interpretation |
|---|---|
| 0.0β0.3 | Mostly zero-fill / padding β skip |
| 0.5β0.8 | Structured data (FS headers, ELF) β extract |
| 0.8β0.95 | Compressed data (gzip, lzma, zlib) β normal |
| 0.95β1.0 flat | AES/RSA encrypted or already-compressed blob β flag for key hunt |
Step 2 β Recursive Extraction
OUTDIR=/workspace/evidence/iot/<target>/extracted
# Recursive extraction (-M), follow symlinks (-r), output to dedicated dir (-C)
binwalk -eM -C "$OUTDIR" "$FW"
# Inspect what was carved
find "$OUTDIR" -maxdepth 4 -type f | head -60
ls -lah "$OUTDIR"/_*
Common extraction outputs
_flash_full.bin.extracted/
squashfs-root/ β mounted squashfs rootfs
40 β raw uImage kernel (strip 64-byte header for vmlinuz)
40.7z β carved archive at offset 0x40
A00000 β raw block at offset 0xA00000
Step 3 β Squashfs (standard + vendor variants)
SQFS=$(find "$OUTDIR" -name "*.squashfs" -o -name "squashfs-root.img" 2>/dev/null | head -1)
# Standard unsquashfs
unsquashfs -d /tmp/squashfs_root "$SQFS"
# Non-standard (Broadcom LZMA, TP-Link XZ, vendor-patched):
sasquatch -d /tmp/squashfs_root "$SQFS"
# If both fail, force a specific compression type:
sasquatch -p 1 -le -d /tmp/squashfs_root "$SQFS" # little-endian
sasquatch -p 1 -be -d /tmp/squashfs_root "$SQFS" # big-endian
# Verify extraction
ls /tmp/squashfs_root/{bin,etc,lib,usr,var} 2>/dev/null
Step 4 β JFFS2
JFFS2_IMG=$(find "$OUTDIR" -name "*.jffs2" 2>/dev/null | head -1)
# Method A: jefferson (Python, handles most variants)
jefferson "$JFFS2_IMG" -d /tmp/jffs2_root
# Method B: kernel loop mount (requires modprobe jffs2 + mtdram)
sudo modprobe mtdram total_size=65536 erase_size=256
sudo modprobe mtdblock
sudo dd if="$JFFS2_IMG" of=/dev/mtd0
sudo mount -t jffs2 /dev/mtdblock0 /mnt/jffs2
Step 5 β UBIFS (NAND-based devices)
UBI_IMG=$(find "$OUTDIR" -name "*.ubi" -o -name "*.ubifs" 2>/dev/null | head -1)
# ubireader_extract_files: most direct path
ubireader_extract_files -o /tmp/ubifs_root "$UBI_IMG"
# For raw UBI volume images, ubiextract:
sudo modprobe ubi
sudo ubiattach -m 0 -d 0 /dev/ubi_ctrl
sudo mount -t ubifs /dev/ubi0_0 /mnt/ubifs
Step 6 β Manual Carving (when binwalk misses)
# Find filesystem magic bytes manually
python3 -c "
import sys
data = open('$FW','rb').read()
sigs = {b'hsqs': 'SquashFS LE', b'sqsh': 'SquashFS BE',
b'\\x19\\x85': 'JFFS2', b'UBI#': 'UBI', b'\\x27\\x05\\x19\\x56': 'uImage'}
for sig, name in sigs.items():
off = 0
while True:
idx = data.find(sig, off)
if idx == -1: break
print(f' {name} @ 0x{idx:08x}')
off = idx + 1"
# Carve a specific region for separate analysis
dd if="$FW" bs=1 skip=$((0xA00000)) count=$((0x600000)) of=/tmp/carved_rootfs.bin
# Run binwalk on the carved piece
binwalk -eM -C /tmp/carved_extract /tmp/carved_rootfs.bin
Step 7 β Nested Archive Handling
# Device firmware often wraps: .zip/.tar β signed header β lz
FAQ
What is entropy analysis?
It measures how random the data is, which helps tell structured file systems from encrypted blobs.
What tool does the extraction?
The guide uses binwalk, along with other tools for special file system formats.
What comes next after extraction?
The guide points to static review of the extracted files, such as checking for hardcoded credentials.
Details
Original description by the author
Firmware image extraction with binwalk and firmware-mod-kit β recursive archive carving, squashfs/jffs2/ubifs mounting, entropy analysis to detect packed/encrypted regions, and nested container handling. Entry point for all static filesystem analysis after a raw binary image is acquired.
Popularity
- GitHub stars
- 6.5k
- Ranking position
- #14094
- License
- Apache-2.0
- Updated
- 11/1/2026
Comments
- β¦
More skills from this repository
detector-overview
6.5kHelps your agent read code that a scanner flagged and decide which flagged spots are real security bugs and which are false alarms.
exploiter-overview
6.5kHelps your agent join several confirmed security weaknesses into one test chain and check how far that chain could reach.
llm-redteam-overview
6.5kHelps your agent find the right AI red-team guide for a test, covering 15 tactic groups from prompt injection to model abuse.
aatmf-t01-prompt-injection
6.5kExplains prompt injection, where hidden instructions try to override an AI system, so security testers can check for it.
Similar skills
reverse-engineer-anything
422kHelps your agent look inside shipped apps and packages to explain features, compare versions, or guide a rebuild, using the REA tool.
1password
394kHelps your agent set up the 1Password CLI, sign in, and read or inject secrets without printing their values into chat.
healthcheck
394kHelps your agent audit the computer or server that runs OpenClaw for security risks, such as SSH, firewall, updates, and backups, then suggest safe fixes.