Repository navigation
Description
Goal
Add IoT firmware analysis to REA by integrating mature identification, extraction, metadata, native-analysis, and runtime tools. Make their results composable for agents through the same CLI/MCP workflows.
This issue records the research and a staged roadmap under REA — One MCP for reverse engineering across binaries, applications, and runtime behavior. Related roadmap: #32.
Distinguish the inputs
| Input | Analysis path |
|---|---|
| Linux-device update/flash image | Identify containers/regions → selected rootfs extraction → settings/artifacts/ELF → existing native analysis |
| MCU/bare-metal image | Explicit CPU/endian/base/entry/memory map → native inspection; target-specific runtime later |
| Raw NAND/hardware dump | Explicit page/OOB/ECC/geometry handling → logical image; do not assume ordinary filesystem extraction covers it |
A .bin extension does not establish any of these semantics. Inspection of an arbitrary blob is distinct from admitting it as a supported executable.
Recommended first integrations
| Tool | Useful capability | REA integration |
|---|---|---|
| Binwalk v3 | Signatures, offsets, entropy, JSON log | Region inspection with evidence and unknowns |
| Unblob | Recursive extraction, chunk boundaries, unknown chunks, JSON reports | Derived-artifact graph, errors, scoped extraction |
| Existing REA artifact/Ghidra providers | Identity, selected extraction, supported native analysis | Reuse for extracted native files |
Prefer one selected extraction engine per operation. Binwalk and Unblob overlap; verify whether both are necessary for a particular outcome rather than running both automatically.
Version and resource findings
- Binwalk v3 is a Rust rewrite under MIT. Research observed latest GitHub release
v3.1.0(2024-10-31) and default-branch activity in 2026. The release and main differ in CLI/log behavior. Bind to the actual version; do not reuse Binwalk v2 Python/CLI assumptions. v3.1.0exposes--logand--threads; analysis results carryfile_path,file_map, and extractions keyed by signature identity. Validate empty, multiple, interrupted, and partial JSON with the real selected version. Release CLI, result source.- Unblob is MIT; research observed release
26.6.4. It has JSON reports and external-extractor dependencies; installing its Python package alone does not establish all-format coverage. Check release-specific behavior instead of assuming current main features are available. Installation, API. - Both have parallel execution settings. Start with one worker, bounded workspace/input handling, and owned-descendant cleanup. Binwalk main reads file data into memory; one thread is not an RSS bound. Report actual budget enforcement and partial results.
Format-specific helpers and metadata
| Candidate | Use |
|---|---|
| squashfs-tools, ONEKEY sasquatch | Standard and vendor SquashFS inspection/extraction |
| ONEKEY UBI Reader | UBI/UBIFS blocks, volumes, extraction; explicit geometry/overrides |
| ONEKEY Jefferson | JFFS2; preserve the tool's actual CRC coverage |
| dtc/libfdt | DT nodes/properties, memory/partition descriptions, raw cells/phandles |
| U-Boot dumpimage | Boot component/configuration metadata and selected extraction |
Use these as extraction dependencies or distinct metadata providers when they answer an additional question. Avoid duplicating identical extraction tools in the MCP inventory. Listing a boot image does not prove its signature is verified. Report declared load/entry metadata separately from actual imported bytes.
Confirmed REA gaps
Research baseline: main af48fe879161.
- BinaryArchitecture currently contains x86/x86_64/arm/arm64. MIPS is absent; PPC/RISC-V are also absent. Ghidra's upstream processor support does not establish REA admission, contracts, or real workflow coverage.
- GhidraAnalysisProfile uses header-based import plus explicit DOS handling. Raw flash needs caller-owned processor/endian, file-to-memory regions, entry/context, and loaded-image verification.
Staged work
- First: firmware region inspection through a versioned Binwalk v3 adapter, without implicit recursive extraction.
- First: caller-selected Unblob extraction, normalized JSON errors/unknown chunks, and derived-artifact provenance.
- First: hand extracted supported native files to existing admission/Ghidra workflows.
- Follow-up: complete MIPS ELF support across header parsing, domain/contracts, target admission, provider profile, and real Ghidra verification; select exact endian/ABI variants.
- Follow-up: boot component/configuration and DT metadata through dumpimage/libfdt/dtc.
- Follow-up: explicit raw-firmware load profiles and loaded-image attestation; select exact processors/context support.
- Later: selected ELF/rootfs observation through Qiling; known-machine guests through QEMU/QMP.
- Later: selected results from a caller-provided local FACT instance or EMBA reports.
Evidence and operational requirements
- Preserve parent/child digests, original paths, chunk ranges, handler/provider/version, errors, unknown regions, and actionable missing dependencies.
- Separate parent-file offsets, decompressed child offsets, and runtime addresses. Preserve derivation even when a byte-level mapping is unknown; compression does not produce a one-to-one offset mapping.
- Signature hits and entropy are observations/inferences with limitations, not proof of a valid filesystem or encryption.
- Reuse shared application workflows, named contracts, existing artifact relationships, and process lifecycle primitives. Keep provider protocols outside domain/application code.
- Bring-your-own tools and isolated workspaces; no automatic root installers, host mounts, global configuration changes, or execution of extracted scripts during inspection. Diagnose only dependencies needed for the selected outcome.
- Component licenses need checking before code reuse/redistribution. For example, dtc and libfdt have different licensing; legacy firmware-mod-kit has unresolved mixed components.
Other useful research references
Firmadyne/FirmAE provide Linux rehosting prior art; neither was archived in the research snapshot. Unicorn is a CPU library, not a full OS. avatar² and HALucinator address target-specific hardware/HAL boundaries. FirmWire is specialized baseband tooling. Keep these for observed needs and specific fixtures.
FACT's REST API is unversioned: pin representative producer data for a local connector. Heavy platforms should remain optional. Firmware Mod Kit, ImHex, Rizin, radare2, and LIEF are further format/interface references, not an initial mandatory stack.
Acceptance for initial milestones
- Small source-generated fixtures have known regions, padding/unknown bytes, compressed filesystem content, and selected ELF children; compare offsets/bytes/digests to an independent generator oracle.
- Exercise missing extractors, partial extraction, malformed inputs, links/path boundaries, duplicate names, depth/resource termination, and cancellation. Preserve useful partial evidence.
- Real Binwalk/Unblob and selected native Ghidra workflows through CLI/MCP, with recorded budgets and unchanged source bytes.
- Real MIPS/raw/runtime lanes are required before claiming their respective coverage; cross-toolchain prerequisites belong only to the lane using them.
- Track fixture generators/source, not private firmware, generated binaries, or project databases. Use focused iteration checks; full CI remains a separate gate.
Research status: documentation, selected upstream code, and version/license metadata reviewed. No firmware extraction/emulation or candidate-tool execution has been performed. Deliver the roadmap as small independently useful PRs.
Activity
feat(native): admit bounded MIPS ELF analysis through Ghidra
fix(ghidra): bound MIPS floating-point mode admission
fix(native): validate MIPS ABI records before Ghidra admission
feat(native): admit bounded MIPS ELF analysis through Ghidra (#1362)
Rinkia commentedon Oct 15, 2026
Real-image data point for the Linux-device path in this roadmap, in case it helps prioritise the remaining native-analysis lanes.
Target: OpenWrt 24.10.8
ath79/generic, TP-Link Archer C7 v5 sysupgrade image (MIPS32r2 big-endian, musl).feeab4e3142feb865450ab044a42e198af9510d263e4b0f6d1cdcc701d296003.sha256sums.asc: good signature from the OpenWrt Build System key.Run:
[email protected]with Binwalk 3.1.0 and Unblob 26.6.4 (caller-supplied, in a derived Docker image) and Ghidra 12.1.4.Identify → extract worked as designed:
inspect_firmware_regionsfinds the uImage (LZMA kernel, Linux 6.6.144) at 0 and the SquashFS root filesystem at 2,627,792.extract_firmwarepublishes 1,094 regular files, all identical by path and SHA-256 to an independentunsquashfsof the same range.Extracted ELF → native analysis. That's where most of the image currently stops. The table shows the Ghidra admission outcome for all 161 ELF files in the root filesystem, with the provider's own refusal reasons:
usign,uhttpd,dnsmasq,rpcd,ubus,libubox,libuciET_REL)ehci-hcd.ko,sha512_generic.ko, …)ET_EXECbusybox,netifd,logd,uci,mtd,kmodloader,swconfigR_MIPS_REL32(MIPS16 shared lane)procd,ubusd,odhcpd,wpad,libubus,libnl-tinyET_DYN)libc.so,libgcc_s.so.1,libmbedtls/x509/crypto,dropbearlibjson-c,libucodeEvery refusal matches a documented boundary in
docs/ghidra-mips.md, and the messages are clear. On a stock OpenWrt build, though, the groups with the biggest reach are:ET_EXEC: in this image,busyboxand most core daemons carry theEF_MIPS_ARCH_ASE_M16flag;libc.soitself.For the admitted binaries, decompilation tracked the source well.
usign'sverify()matchesmain.catf1f65026in control flow and constants.Issues filed from this run: #4175 (symlink targets reported as Unblob rewrote them), #4176 (the 120 s extraction deadline also covers publication, so a Docker Desktop bind mount times out) and #4177 (musl
stderrcopy-relocated into RELRO is shown as(FILE *)0x0in pseudocode).