Firmware & Web3Environment: Linux container or host with Binwalk and Unblob tools installedMCP Tool: extract_firmware

How to REA Embedded Firmware: Binwalk Header Scanning & SquashFS Extraction

Extract and audit IoT router, automotive, and embedded device firmware: scan binary flash ROMs for magic signatures, unpack SquashFS, CramFS, and JFFS2 filesystems, and hand off extracted ARM/MIPS binaries to decompilers.

AI Overview Direct AnswerHow to REA: Embedded Firmware Images Quickstart Summary

In this official REA guide for Embedded Firmware Images, AI coding agents (Claude Code, Cursor, Windsurf) execute 'rea extract ./router_firmware.bin --provider binwalk --json' to safely extract file layout, symbols, and code logic without launching unverified binaries.

Investigation ScenarioReal-World Objective

The Problem & Target Artifact

IoT security testing: You dumped the SPI flash chip of an IP camera or Wi-Fi router. You need to extract the Linux root filesystem, locate the web management daemon, and audit its authentication logic.

Target Artifact: Binary firmware image (.bin, .rom, .img).
AI PromptClaude Code / Cursor / Windsurf

Natural Language Agent Instructions

Copy and paste this prompt directly into your AI coding agent when REA is registered via Model Context Protocol (MCP):

Prompt Template:Select All to Copy
Scan and extract ./router_firmware.bin using Binwalk. Extract the root filesystem, locate the web server executable (httpd), and list all default configuration files in /etc.
ExecutionTerminal & MCP Tool Call

Run REA Analysis Command

Execute the following command in your terminal or inspect the MCP JSON-RPC call executed by your agent:

CLI Command Execution
rea extract ./router_firmware.bin --provider binwalk --json

What REA Extracts & Returns

Magic header identification: U-Boot bootloader images, Linux kernels (zImage), and compressed partitions
Carved filesystem hierarchies: SquashFS, CramFS, JFFS2, and tar/gzip archives
Extracted directory structure ready for static file analysis (/etc/shadow, /bin, /www)
Automated architecture detection (MIPS big-endian, ARM little-endian) for decompiler handoff

Extracted Firmware Partition Layout

The verified findings and synthesized clean-room structures generated from this investigation:

Extracted Firmware Partition Layout
{
  "image": "router_firmware.bin",
  "partitions": [
    { "offset": "0x00000000", "description": "u-boot bootloader", "size": "0x00040000" },
    { "offset": "0x00040000", "description": "Linux kernel image (LZMA)", "size": "0x00180000" },
    {
      "offset": "0x001c0000",
      "description": "SquashFS filesystem (little-endian, version 4.0)",
      "extracted_path": "/artifacts/squashfs-root",
      "target_binaries": ["/bin/httpd", "/sbin/rc"]
    }
  ]
}
Internal MechanicsProduction Engineering

Signature Carving & Safe Sandboxed Extraction

REA invokes Binwalk or Unblob within an isolated directory tree. It validates file magic bytes and compression headers (LZMA, gzip, zstandard) to establish partition offsets, then recursively unpacks nested filesystems while enforcing a strict destination depth cap to protect against ZIP-bomb/tar-bomb path traversal exploits.

Security Guardrails & Analysis Boundary Rules

Defends against symlink attacks and path traversal tricks embedded in malicious firmware images.
Hands extracted binaries directly to Ghidra using the correct endianness and processor flags.
Inspects default admin credentials, hardcoded SSH private keys, and insecure startup scripts.