Skip to content

Hunting Specifics

A full scan answers "what is in here?" Often the real question is narrower: is there a SquashFS in here at all? Where does this byte pattern occur? What architecture is this lump of code for? Binwalk's hunting tools each trade the full table for one sharp answer.

Filter the table: -y and -x

-y <text> keeps only results whose description matches; -x <text> removes them. On the specimen, asking for just the filesystem:

$ binwalk -y squashfs specimen.bin

65536         0x10000         Squashfs filesystem, little endian, version 4.0, compression:gzip, size: 650 bytes, 7 inodes, blocksize: 131072 bytes, created: 2026-11-05 09:02:09

One row, no noise. On a real image with forty rows, this is how you ask "which of these are the filesystems" or "show me everything except the PNG and JPEG clutter" (-x). The matching is on the description text, so you filter on the vocabulary of the table itself — squashfs, gzip, certificate, private key are all productive things to hunt in firmware.

Raw search: -R

Signatures validate; raw search doesn't. -R looks for a byte sequence you specify, exactly as written, and reports every occurrence — including ones a validator would reject:

$ binwalk -R '\x1f\x8b\x08' specimen.bin

69632         0x11000         Raw signature (\x1f\x8b\x08)
69776         0x11090         Raw signature (\x1f\x8b\x08)
78144         0x13140         Raw signature (\x1f\x8b\x08)

Three hits: the two genuine gzip members and the trap at 78144 that the signature scan deliberately hid. Neither tool is lying. The signature scan answers "where are the gzip streams binwalk believes in"; the raw search answers "where do these bytes occur." Reach for -R when you have a specific prey — a known header, a fragment of a key, a string of bytes from a datasheet — and treat its hits with the suspicion the false positives chapter teaches, because raw search has no validator standing behind it at all.

Opcode scan: -A

Some firmware members are bare code: no header, no filesystem, just instructions for some processor. -A scans for opcode signatures — the characteristic byte patterns of function prologues, epilogues, and common instructions — to guess the architecture. The shipped opcode signatures cover the embedded world: ARM (including Thumb), MIPS in its several endiannesses and variants, PowerPC, and others of that class.

Honesty requires showing this guide's own attempt. A small C program was compiled on the build machine and scanned:

$ binwalk -A hello

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
(empty)

Nothing — and correctly nothing. The build machine is x86-64, and the opcode library is not aimed at desktop processors; it is aimed at the raw code blobs of routers and cameras, where naming the architecture is the first step to every later analysis (it is the question the Ghidra guide makes you answer before loading a binary, too). Run -A on headerless lumps carved out of embedded images; expect silence on ordinary PC executables, and don't read that silence as "no code here."

Your own signatures: -m

Binwalk's signatures live in text magic files in the classic libmagic format — an offset, a type, a value to match, a description to print, and continuation lines (beginning with >) that read further fields when the first line matches. You can hand binwalk a magic file of your own with -m, which is how you teach it a format it doesn't know — say, your own product's header. The specimen's invented header is exactly such a format. The whole magic file:

0   string      MMLAB-FW    Mere Mortals lab firmware header
>9  string      x       \b, version: "%s"

Line one: at offset 0, match the string MMLAB-FW, describe it as shown. Line two: if line one matched, read the string at offset 9 and append it as a version. The result, run for real:

$ binwalk -m lab-magic specimen.bin

0             0x0             Mere Mortals lab firmware header, version: "1.0"

The header the stock scan ignored is found, and its version field is read. Two behaviours to note before you build on this. First, -m replaces the built-in signature set for that run — the SquashFS and gzip rows are gone from this output, because only the given file was loaded. Second, this is a survey of the format, not its whole grammar: the shipped magic files in binwalk's own library (binwalk/magic/ beside the Python package) are the real textbook, hundreds of entries showing numeric types, endianness, masks, and nested continuations. Reading the shipped entry for a format you care about is the fastest way to understand both the format and the language.

Check: four hunts, four different kinds of answer — a filtered table (-y), occurrences without judgement (-R), an architecture guess that honestly abstains on desktop code (-A), and a signature you wrote yourself finding a header nothing else could (-m). Choosing among them is choosing how much validation you want behind the hit.