Skip to content

Binwalk for Mere Mortals

Inside every router, camera, and smart plug there is a whole small computer's worth of software, and it travels as a single file: the firmware image. Bootloader, kernel, an entire root filesystem, sometimes archives inside archives — one file with many files hidden in it, at offsets nobody labels. Binwalk is the tool that opens that file without running it. It scans every offset for the signatures of known formats, prints a map of the members it finds, carves them out, unpacks the ones it knows how to unpack, and can recurse into whatever it just extracted — because firmware, like the dolls the recursion is named after, nests.

This guide teaches that workflow the way the series teaches everything: on evidence. It builds a specimen image out of harmless text files — a real SquashFS filesystem, two gzip members, a tar nested inside one of them, a region of random bytes, and one deliberate lie — then scans it, extracts it, recurses into it, and proves the planted files came back byte for byte, by checksum. Along the way it keeps the traps in frame: the rows the plain scan silently hides, the executable that appears inside pure randomness, the confident description that turns out to be a misread header field.

A note on verification, because it matters here. Everything hands-on in this guide was run for real on the build machine with Binwalk v2.3.3 — the Python generation that Linux distributions package — against the specimen described above: offsets reconciled against the builder's manifest, extractions checksummed, the nested marker recovered from three layers down. The current upstream is a Rust rewrite (v3) with a reorganised command line; it is covered from the project's own documentation, and the installing chapter says plainly which generation each claim belongs to. Nothing in these chapters presents a step as tested that wasn't. criteria.md keeps the exact ledger.

What this guide covers

  • What binwalk is — firmware images, signature scanning, and the three verbs: scan, extract, recurse
  • Installing binwalk — the two generations (Python v2, Rust v3), and the shelf of helper tools extraction quietly depends on
  • Your first scan — reading the signature table against a manifest you trust, and noticing what the table doesn't show
  • Extraction — carving members out, the _*.extracted tree, the root refusal that teaches the safety rule, and proving a recovered file by checksum
  • Matryoshka extraction — recursive scanning, generation by generation, and the guards that keep it from filling your disk
  • Entropy — reading the rising and falling edges, and the three things a plot can never tell you
  • The filesystems inside — SquashFS, JFFS2, UBI, CramFS and friends, and the helper each one needs to open
  • Hunting specifics — filters, raw byte search, opcode scans, and writing a signature of your own
  • The worked specimen — the whole workflow in one sitting, build to proof
  • False positives — the phantom executable, the trap, and the plausible lies, all from one small file
  • The neighbours — file, strings, 7-Zip, firmware-mod-kit, FACT, and where Ghidra takes over
  • Troubleshooting — missing members, missing helpers, and scans that find nothing
  • Glossary — the terms, collected in one place

What it doesn't cover

Modifying firmware or building an image to flash back onto a device (that is firmware-mod-kit's bench, and a bricking risk this guide deliberately stays clear of), analysing the programs found inside an image (the companion Ghidra for Mere Mortals takes over there), defeating encrypted or signature-verified images, and any device you don't own or aren't authorised to examine. Examining firmware you own is the whole premise; the safety notes in the extraction chapter are part of the method, not a formality.

How to use this guide

Read the first two chapters away from the keyboard; they are the mental model and the map of the two versions. Then build the specimen in the worked specimen chapter and run the six steps with your own hands — every later idea in the guide is a variation on something that happens in that one small file. Only then point binwalk at a real image, on a machine you can afford to lose, and keep the manifest habit: decide what you expect to find before you scan, and make the scan answer to it.