binwalk-extract
하는 일
이 가이드는 펌웨어 이미지를 검토할 수 있도록 파일 시스템으로 풀어내는 방법을 다룹니다. 권한이 있는 펌웨어를 분석하는 보안 분석가를 위한 것입니다.
사용하는 경우
- ✓검토를 위해 원본 펌웨어 이미지의 파일 시스템을 추출해야 할 때.
- ✓펌웨어 이미지에 압축 영역이나 암호화 영역이 있어 이를 구분해야 하는 경우.
- ✓비표준 파일 시스템 형식이라 특수 도구가 필요한 펌웨어 이미지를 다룰 때.
스킬 링크
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/iot/binwalk-extract/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“우리 장치의 펌웨어 이미지가 있습니다. 압축을 풀고 파일 시스템에 무엇이 있는지 알려 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 이미지에서 알려진 파일 서명을 스캔하고, 엔트로피를 측정해 압축되거나 암호화된 영역을 찾아내며, 읽을 수 있는 파일 시스템을 추출합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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
자주 묻는 질문
엔트로피 분석이란 무엇인가요?
데이터가 얼마나 무작위인지 측정하는 방법입니다. 구조화된 파일 시스템과 암호화된 덩어리를 구분하는 데 도움이 됩니다.
추출에는 어떤 도구를 쓰나요?
가이드는 binwalk를 쓰고, 특수 파일 시스템 형식에는 다른 도구도 함께 사용합니다.
추출 후에는 무엇을 하나요?
추출된 파일을 정적으로 검토하는 단계로 넘어가며, 하드코딩된 자격 증명을 찾는 것이 예입니다.
상세 정보
작성자의 원본 설명
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.
인기도
- GitHub 스타
- 6.5k
- 순위
- #14094
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
detector-overview
6.5k에이전트가 스캐너가 표시한 코드를 읽고, 표시된 곳 중 어디가 실제 보안 버그이고 어디가 오탐인지 판단하도록 돕습니다.
exploiter-overview
6.5k에이전트가 확인된 여러 보안 약점을 하나의 테스트 체인으로 묶고, 그 체인이 어디까지 닿을 수 있는지 확인하도록 돕습니다.
llm-redteam-overview
6.5k에이전트가 프롬프트 인젝션부터 모델 악용까지 15개 전술 그룹 중 테스트에 맞는 AI 레드팀 가이드를 찾도록 돕습니다.
aatmf-t01-prompt-injection
6.5k숨겨진 지시가 AI 시스템을 덮어쓰려 하는 프롬프트 인젝션을 설명해, 보안 테스터가 이를 점검할 수 있게 합니다.