binwalk-extract
Skill này làm gì
Hướng dẫn này nói về việc giải nén ảnh firmware thành hệ thống file để có thể rà soát. Dành cho nhà phân tích bảo mật làm việc với firmware mà họ được ủy quyền kiểm tra.
Khi nào nên dùng
- ✓Khi bạn có một ảnh firmware thô cần trích xuất hệ thống file để rà soát.
- ✓Khi một ảnh firmware dường như chứa vùng nén hoặc mã hóa và bạn cần phân biệt chúng.
- ✓Khi một ảnh firmware dùng định dạng hệ thống file không chuẩn cần công cụ đặc biệt.
Liên kết skill
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/iot/binwalk-extract/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tôi có một ảnh firmware từ một trong các thiết bị của chúng tôi. Bạn có thể giải nén nó và cho biết có gì trong hệ thống file không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent quét ảnh tìm các chữ ký file đã biết, đo entropy để phát hiện vùng nén hoặc mã hóa, rồi trích xuất các hệ thống file có thể đọc được.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
Phân tích entropy là gì?
Nó đo mức độ ngẫu nhiên của dữ liệu, giúp phân biệt hệ thống file có cấu trúc với khối dữ liệu mã hóa.
Công cụ nào thực hiện trích xuất?
Hướng dẫn dùng binwalk, cùng các công cụ khác cho định dạng hệ thống file đặc biệt.
Bước tiếp theo sau khi trích xuất là gì?
Hướng dẫn chỉ đến việc rà soát tĩnh các file đã trích xuất, như tìm thông tin đăng nhập cứng.
Chi tiết
Mô tả gốc của tác giả
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.
Độ phổ biến
- Sao GitHub
- 6.5k
- Vị trí xếp hạng
- #14094
- Giấy phép
- Apache-2.0
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
detector-overview
6.5kGiúp agent của bạn đọc code mà một công cụ quét đã đánh dấu, rồi quyết định điểm nào là lỗ hổng bảo mật thật và điểm nào là báo động giả.
exploiter-overview
6.5kGiúp agent của bạn ghép nhiều lỗ hổng bảo mật đã xác nhận thành một chuỗi kiểm thử và kiểm tra chuỗi đó có thể gây hậu quả đến đâu.
llm-redteam-overview
6.5kGiúp agent của bạn tìm đúng hướng dẫn red-team AI cho một bài kiểm thử, bao quát 15 nhóm chiến thuật từ prompt injection đến lạm dụng mô hình.
aatmf-t01-prompt-injection
6.5kGiải thích prompt injection, khi các chỉ dẫn ẩn cố ghi đè một hệ thống AI, để chuyên gia bảo mật có thể kiểm tra lỗi này.
Skill tương tự
reverse-engineer-anything
422kGiúp agent của bạn xem bên trong các app và package đã phát hành để giải thích tính năng, so sánh phiên bản hoặc hướng dẫn dựng lại bằng công cụ REA.
1password
394kGiúp agent của bạn cài đặt CLI của 1Password, đăng nhập, và đọc hoặc đưa thông tin bí mật vào mà không in giá trị ra cuộc trò chuyện.
healthcheck
394kGiúp agent của bạn rà soát bảo mật máy tính hoặc máy chủ đang chạy OpenClaw, như SSH, tường lửa, cập nhật và sao lưu, rồi đề xuất cách sửa an toàn.