/firmware-reverse-engineering:firmware-emulationfrom firmware-reverse-engineering
Runs extracted firmware in QEMU for dynamic analysis, debugging, and vulnerability testing. Covers user-mode, system-mode, automated tools (Firmadyne/FirmAE), GDB debugging, and network traffic analysis.
Ships in firmware-reverse-engineering. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Run extracted firmware in controlled environments for dynamic analysis, debugging, and vulnerability testing. This skill provides comprehensive workflows for both automated and manual emulation approaches.
Before starting emulation, determine the best approach:
Use AUTOMATED (Firmadyne/FirmAE) when:
Use USER-MODE (qemu-user) when:
Use SYSTEM-MODE (qemu-system) when:
Examples with sudo, TAP/iptables or chroot assume a disposable Linux analysis
VM. Chroot and QEMU user-mode are not security boundaries and share the host
kernel/network. Keep debugger listeners inside that VM; QEMU's GDB stub has no
authentication. -L supplies an interpreter prefix, not an isolated rootfs.
Interactive foreign shells need suitable binfmt_misc registration for subsequent
execve calls, or each foreign executable must be launched through QEMU.
# QEMU (all architectures)
sudo apt-get install qemu-system qemu-user-static qemu-user
# Cross-architecture debugging
sudo apt-get install gdb-multiarch
# Network tools
sudo apt-get install bridge-utils uml-utilities tcpdump wireshark tshark
# Filesystem tools
sudo apt-get install squashfs-tools mtd-utils
# Optional but recommended
pip3 install python-magic scapy
# See firmware-extraction for standalone Binwalk 3.1.0; automated frameworks
# may instead require the legacy Python Binwalk API in a separate environment.
# For Firmadyne/FirmAE
sudo apt-get install postgresql python3-psycopg2
# Check QEMU versions
qemu-arm --version
qemu-system-arm --version
# Check GDB
gdb-multiarch --version
# List available QEMU machines
qemu-system-arm -M help
qemu-system-mips -M help
Follow this systematic approach for firmware emulation:
Try automated tools for supported Linux firmware; success depends on the corpus, architecture, kernel and hardware assumptions.
# Ensure firmware is extracted
# Use firmware-extraction skill if needed
ls -la squashfs-root/
# Note firmware details
file vmlinux # Kernel if present
cat squashfs-root/etc/version # Firmware version
FirmAE is recommended over Firmadyne (better success rate).
cd /path/to/FirmAE
# Automated analysis
sudo ./run.sh -r "Brand" /path/to/firmware.bin
# Wait for completion (5-15 minutes typically)
# FirmAE will:
# - Extract filesystem
# - Detect architecture
# - Create QEMU image
# - Boot firmware
# - Run network analysis
# Check FirmAE output for IP address
# Typical: 192.168.0.1 or 192.168.1.1
# Scan for open services
nmap -p- -A 192.168.0.1
# Access web interface
curl http://192.168.0.1/
# Or open in browser
# Try telnet/SSH
telnet 192.168.0.1
ssh [email protected]
# Check scratch/<IMAGE_ID>/ for logs; capture explicitly if a pcap is needed.
# Or capture live
sudo tcpdump -i tap1_0 -w analysis.pcap
# Analyze in Wireshark
wireshark analysis.pcap
If FirmAE/Firmadyne doesn't boot the firmware:
run.sh -a means analysis, not architecture selection/path/to/FirmAE/scratch/<ID>/ for logsReference: See references/automated-emulation.md for complete Firmadyne/FirmAE guide.
Run individual binaries without full system emulation.
# Mount extracted filesystem
sudo mkdir -p /mnt/firmware
sudo mount -o loop rootfs.ext4 /mnt/firmware
# Or if directory: sudo mount --bind squashfs-root/ /mnt/firmware
# Copy qemu-static (critical!)
sudo cp /usr/bin/qemu-arm-static /mnt/firmware/usr/bin/
# Use appropriate arch: qemu-mips-static, qemu-aarch64-static, etc.
# Run simple command
sudo chroot /mnt/firmware /usr/bin/qemu-arm-static /bin/busybox
# Interactive shell
sudo chroot /mnt/firmware /usr/bin/qemu-arm-static /bin/sh
# Check architecture matches
file /mnt/firmware/bin/busybox
# Should match qemu-XXX-static used
# Identify target (e.g., web server)
find /mnt/firmware -name "*httpd*"
# Run with arguments
sudo chroot /mnt/firmware /usr/bin/qemu-arm-static /usr/sbin/httpd -f -p 8080
# For BusyBox httpd, -f means foreground; flags differ between servers.
# -p 8080: port 8080
# Access from host
curl http://localhost:8080/
# Start binary with GDB server
sudo chroot /mnt/firmware /usr/bin/qemu-arm-static -g 1234 /usr/sbin/httpd
# In another terminal
gdb-multiarch /mnt/firmware/usr/sbin/httpd
(gdb) target remote :1234
(gdb) break main
(gdb) continue
Reference: See references/qemu-user.md for comprehensive user-mode guide.
System emulation requires a kernel, DTB and rootfs compatible with the selected board. Matching CPU architecture alone is insufficient; vendor kernels commonly need unavailable SoC peripherals.
# Locate kernel
find extracted/ -name "vmlinux" -o -name "zImage" -o -name "uImage"
# Check kernel arch
file vmlinux
# ELF 32-bit LSB executable, ARM → use qemu-system-arm
# Locate device tree (ARM/AArch64)
find extracted/ -name "*.dtb"
# Prepare rootfs
# If extracted as directory, create ext4 image
dd if=/dev/zero of=rootfs.ext4 bs=1M count=256
mkfs.ext4 rootfs.ext4
mkdir /tmp/mnt
sudo mount -o loop rootfs.ext4 /tmp/mnt
sudo cp -a squashfs-root/. /tmp/mnt/
sudo umount /tmp/mnt
# List available machines for architecture
qemu-system-arm -M help
# Common choices:
# ARM: versatilepb (requires a compatible kernel/DTB), vexpress-a9
# MIPS: malta
# AArch64: virt
# x86: pc (default)
# ARM example
qemu-system-arm \
-M versatilepb \
-kernel zImage \
-dtb versatile-pb.dtb \
-drive file=rootfs.ext4,if=sd,format=raw \
-append "root=/dev/mmcblk0 console=ttyAMA0 rw debug" \
-nographic \
-m 256M
# MIPS example
qemu-system-mips \
-M malta \
-kernel vmlinux \
-hda rootfs.ext4 \
-append "root=/dev/sda console=ttyS0 nokaslr" \
-nographic \
-m 256M
# Create TAP interface (requires root)
sudo tunctl -t tap0 -u $USER
sudo ifconfig tap0 192.168.100.1 netmask 255.255.255.0 up
# Enable forwarding
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# Boot with TAP networking
qemu-system-arm \
-M versatilepb \
-kernel zImage \
... \
-net nic,macaddr=52:54:00:12:34:56 \
-net tap,ifname=tap0,script=no,downscript=no
# Inside guest, configure network
ifconfig eth0 192.168.100.2 netmask 255.255.255.0 up
route add default gw 192.168.100.1
Kernel panic - cannot mount root:
# Try different root devices
-append "root=/dev/sda ..." # IDE disk
-append "root=/dev/vda ..." # VirtIO disk
-append "root=/dev/mmcblk0 ..." # SD card
# Specify filesystem type
-append "root=/dev/sda rootfstype=ext4 ..."
# Boot to shell for debugging
-append "init=/bin/sh ..."
No output / black screen:
# Ensure -nographic flag
# Try different console device
-append "console=ttyS0 ..." # Serial
-append "console=ttyAMA0 ..." # ARM UART
# Enable early kernel messages
-append "earlyprintk debug loglevel=8 ..."
Wrong machine type:
# Select only a board supported by the supplied kernel/DTB
-M versatilepb # Instead of device-specific
-M virt # Generic virtual machine
Reference: See references/qemu-system.md for architecture-specific boot recipes.
# Start QEMU with GDB server (paused)
qemu-system-arm \
-M versatilepb \
-kernel zImage \
... \
-gdb tcp:127.0.0.1:1234 -S
# -S: Pause at startup
# Connect GDB
gdb-multiarch vmlinux
(gdb) target remote :1234
(gdb) break start_kernel
(gdb) continue
# Set breakpoints on kernel functions
break do_fork
break sys_execve
break do_IRQ
# Step through boot
continue
step
nexti
# Examine kernel state
info registers
x/10i $pc
backtrace
Run a target-architecture gdbserver inside the guest for process-aware debugging;
the system QEMU stub exposes CPUs and does not automatically track processes.
Use a separate guest port and connect over the isolated emulation network:
# Inside guest
gdbserver :2345 /usr/sbin/httpd -f
# On host
gdb-multiarch ./rootfs/usr/sbin/httpd
target remote 192.168.100.2:2345
break main
continue
# Examine application state
print variable
x/10x $sp
info threads
# Watch memory location
watch *0x8048000
# Watch variable
watch global_var
# Conditional watchpoint
watch variable if variable > 100
Reference: See references/gdb-debugging.md for comprehensive GDB techniques.
# Start capture before booting firmware
sudo tcpdump -i tap0 -w capture.pcap &
CAPTURE_PID=$!
# Boot firmware
qemu-system-arm ...
# Interact with firmware
# Traffic is being captured
# Stop capture
sudo kill -INT "$CAPTURE_PID"
# Open in Wireshark
wireshark capture.pcap
# Or use tshark for CLI analysis
tshark -r capture.pcap -Y "http"
tshark -r capture.pcap -Y "tcp.port == 23" # Telnet
# HTTP POST data
tshark -r capture.pcap -Y "http.request.method == POST" -T fields -e http.file_data
# Telnet passwords (cleartext)
tshark -r capture.pcap -q -z follow,tcp,ascii,0 # Select the Telnet tcp.stream index
# FTP credentials
tshark -r capture.pcap -Y "ftp.request.command == USER || ftp.request.command == PASS"
# Install mitmproxy
pipx install mitmproxy
# Start transparent proxy
sudo mitmproxy --mode transparent --showhost
# Redirect firmware traffic
sudo iptables -t nat -A PREROUTING -i tap0 -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo iptables -t nat -A PREROUTING -i tap0 -p tcp --dport 443 -j REDIRECT --to-port 8080
# HTTPS decryption also requires the guest to trust the proxy CA and no
# unhandled certificate pinning. Record any trust-store changes in the report.
# View and modify in real-time
Reference: See references/network-analysis.md for protocol analysis and MITM techniques.
# Access web interface
curl http://192.168.100.2/
# Directory brute-force
dirb http://192.168.100.2/ /usr/share/dirb/wordlists/common.txt
# Vulnerability scanning
nikto -h http://192.168.100.2/
nmap --script vuln -p 80 192.168.100.2
# SQL injection testing
sqlmap -u "http://192.168.100.2/login.php" --forms --batch
# Command injection
curl "http://192.168.100.2/cgi-bin/test.cgi?cmd=;ls"
# With AFL++ in QEMU mode
export QEMU_LD_PREFIX="$PWD/rootfs"
# Build AFL++ QEMU instrumentation for the target architecture first.
afl-fuzz -Q -i input_dir -o output_dir -- \
./rootfs/usr/bin/target @@
# Custom fuzzer for network service
for i in {1..1000}; do
echo "Fuzzing iteration $i"
python3 fuzzer.py 192.168.100.2 9000
done
# Develop exploit against running firmware
# 1. Identify vulnerability through fuzzing
# 2. Debug with GDB to understand crash
qemu-arm -g 1234 -L ./rootfs/ ./vulnerable_binary
gdb-multiarch ./vulnerable_binary
(gdb) target remote :1234
# 3. Craft exploit
# 4. Test against emulated firmware
python3 exploit.py 192.168.100.2
Symptom: Kernel panic, no output, or boot hang
Solutions:
file vmlinux vs qemu-system-XXX-M help lists options-append "debug loglevel=8" for more output-append "init=/bin/sh" to bypass normal initSymptom: Can't ping or connect to emulated firmware
Solutions:
ip addr show tap0-net nic -net tap,ifname=tap0-netdev user,id=net0Symptom: Connection refused or Remote 'g' packet reply is too long
Solutions:
-gdb tcp:127.0.0.1:1234gdb-multiarch not regular gdbset architecture armfile vmlinux before connectingSymptom: Segfault or illegal instruction
Solutions:
-L ./rootfs/ldd inside chroot-cpu cortex-a9QEMU_STRACE=1 qemu-arm ...Symptom: Daemon fails to start or exits immediately
Solutions:
-f for BusyBox httpd)strace# 1. Extract firmware (firmware-extraction skill)
binwalk -e firmware.bin
# 2. Emulate extracted firmware (this skill)
qemu-system-arm -kernel zImage ...
# 1. Emulate and identify interesting binaries
nmap -sV 192.168.100.2
# 2. Extract those binaries
cp /mnt/firmware/usr/sbin/httpd ./
# 3. Static analysis (firmware-static-analysis skill)
readelf -h httpd
objdump -d httpd
# Complete firmware analysis pipeline
# 1. Extract
binwalk -e firmware.bin
cd /path/to/extracted/rootfs/ # Use the actual extraction output path
# 2. Quick automated emulation attempt
cd /path/to/FirmAE
sudo ./run.sh -r Brand /path/to/firmware.bin
# 3. If automated fails, manual system emulation
qemu-system-arm -M versatilepb -kernel zImage ...
# 4. Capture network traffic
sudo tcpdump -i tap0 -w capture.pcap &
CAPTURE_PID=$!
# 5. Identify services
nmap -p- -A 192.168.100.2
# 6. Static analysis of key binaries
readelf --dyn-syms --wide ./rootfs/usr/sbin/httpd
# 7. Debug specific binary
qemu-arm -g 1234 -L ./rootfs/ ./rootfs/usr/sbin/httpd
gdb-multiarch ./rootfs/usr/sbin/httpd
(gdb) target remote :1234
# 8. Test for vulnerabilities
nikto -h http://192.168.100.2/
sqlmap -u "http://192.168.100.2/login.php"
# 9. Document findings
Record emulation setup and findings:
# Firmware Emulation Report
**Firmware**: [filename]
**Date**: [date]
**Analyst**: [name]
## Emulation Method
- **Approach**: [Automated/User-Mode/System-Mode]
- **Tool**: [FirmAE/QEMU/Both]
- **Architecture**: [ARM/MIPS/x86/etc.]
- **Success**: [Yes/Partial/No]
## Configuration
### QEMU Command
```
[paste working qemu command]
```
### Network Configuration
- **IP Address**: [guest IP]
- **Gateway**: [gateway IP]
- **Interface**: [tap0/user-mode]
## Services Identified
| Port | Service | Version | Notes |
|------|---------|---------|-------|
| 80 | HTTP | lighttpd 1.4.x | Web interface |
| 23 | Telnet | BusyBox | Default creds: admin/admin |
## Findings
### Network Traffic
- [Key observations from packet capture]
- [Credentials found]
- [Suspicious protocols]
### Vulnerabilities
- [CVE-XXXX-XXXX: Description]
- [Command injection in cgi-bin/admin.cgi]
### Debug Notes
- [Breakpoints set]
- [Interesting memory locations]
- [Crash analysis]
## Issues Encountered
- [Problems and solutions]
- [Workarounds used]
## Next Steps
1. [Further testing needed]
2. [Exploit development targets]
3. [Code review recommendations]
references/qemu-system.md - Architecture-specific system emulationreferences/qemu-user.md - Individual binary emulationreferences/gdb-debugging.md - Advanced debugging techniquesreferences/network-analysis.md - Traffic capture and protocol analysisreferences/automated-emulation.md - Firmadyne and FirmAE complete guide# User-mode emulation
sudo chroot /mnt/firmware /usr/bin/qemu-arm-static /bin/sh
# System-mode emulation (ARM)
qemu-system-arm -M versatilepb -kernel zImage -drive file=rootfs.ext4,if=sd \
-append "root=/dev/mmcblk0 console=ttyAMA0" -nographic
# GDB debugging
qemu-arm -g 1234 binary
gdb-multiarch binary → target remote :1234
# Network capture
sudo tcpdump -i tap0 -w capture.pcap
# FirmAE automated
sudo ./run.sh -r Brand firmware.bin
# Check architecture
file binary
# Create TAP interface
sudo tunctl -t tap0 -u $USER
sudo ifconfig tap0 192.168.100.1/24 up
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
firmware-analysis, qemu, gdb-debugging, iot-security, dynamic-analysis
npx claudepluginhub orbitcurve/firmware-reverse-engineering --plugin firmware-reverse-engineering5 skills in this plugin
/firmware-extractionExtract firmware images and embedded filesystems using unblob first, summarize its JSON report, and investigate unresolved regions with Binwalk or filesystem-specific tools. Use for device dumps and manufacturer update images, including nested, unsupported, encrypted, or damaged formats. For individual ELF analysis use firmware-static-analysis; for execution use firmware-emulation./firmware-security-reportsEvidence-based security report generation for firmware assessments. Use when the agent needs to create technical security reports from firmware analysis. Covers: (1) Full penetration test reports with executive summaries and technical details, (2) Individual vulnerability findings with CVSS 3.1 scoring, (3) Working notes for documentation during assessment, (4) Integration with firmware analysis skills (extraction, static analysis, Ghidra RE, emulation). Outputs to markdown and PDF formats. Technical audience only. Includes templates for findings, PoC code, remediation guidance, and evidence documentation./firmware-static-analysisSystematic static analysis of ELF firmware binaries using command-line tools (file, strings, readelf, objdump, xxd). Use when the agent needs to perform initial reconnaissance on firmware/embedded binaries before reverse engineering, specifically for (1) Identifying architecture and binary characteristics, (2) Extracting metadata, strings, and imports, (3) Analyzing symbols, sections, and entry points, (4) Understanding binary structure and dependencies, (5) Generating structured analysis reports. Covers ARM, MIPS, x86, RISC-V, PowerPC architectures. Does NOT handle firmware extraction/unpacking (use separate skill for that)./ghidra-reExpert-level Ghidra reverse engineering for firmware binaries with emphasis on stripped binary analysis, automated function discovery, cryptographic routine identification, authentication logic detection, and vulnerability hunting. Use when the agent needs to perform deep static analysis of firmware binaries in Ghidra. Covers: (1) Stripped binary analysis techniques (function discovery via prologues, xrefs, string tracing), (2) Type recovery and structure reconstruction, (3) Automated analysis via Python scripting (Ghidra API), (4) Cryptographic function identification (AES, MD5, SHA constants), (5) Authentication and authorization function discovery, (6) Vulnerability detection (buffer overflows, format strings, command injection, manual data-flow verification), (7) Decompiler enhancement and custom type propagation, (8) Integration with emulation workflow. Assumes expert RE knowledge. Complements firmware-static-analysis (basic recon) and firmware-emulation (dynamic analysis).Other plugins' skills for the same job