Skip to content

Your First Scan

A first scan should be run against an image whose true contents you already know — otherwise you cannot tell a good result from a plausible one. So this guide builds its own specimen. The script examples/make_specimen.py assembles a harmless 78,202-byte file from parts written for the purpose: an invented 16-byte header, 64 KB of zeros, a real SquashFS filesystem holding three small text files, two gzip members (one carries plain release notes; the other carries a tar archive with a text file inside), 8 KB of random bytes standing in for encrypted data, and — at the very end — a trap, the first bytes of a gzip stream with no stream behind them.

The script prints a manifest as it builds. This is the answer key, recorded before any scanning:

    offset        hex     size  member
         0          0       16  invented header (no Binwalk signature)
     65536      10000     4096  SquashFS root filesystem
     69632      11000      143  gzip member (release notes)
     69776      11090      171  gzip member (tar with marker)
     69952      11140     8192  random data (entropy stand-in)
     78144      13140       58  TRAP: bare gzip magic, no stream

Now the scan itself. Binwalk with no options but a filename does a signature scan:

$ binwalk specimen.bin

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
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
69632         0x11000         gzip compressed data, maximum compression, from Unix, last modified: 1970-01-01 00:00:00 (null date)
69776         0x11090         gzip compressed data, maximum compression, from Unix, last modified: 1970-01-01 00:00:00 (null date)

Reading the table

Three columns, and each deserves a sceptical reading:

  • DECIMAL / HEXADECIMAL — the offset: how far into the file the member begins. Both columns say the same thing; the extraction chapter will name its output files in hex.
  • DESCRIPTION — not a measurement. Binwalk found the format's magic bytes at that offset, then read the format's own header fields and printed what they claim: the SquashFS superblock's version, compression, inode count and creation date; the gzip header's compression level and timestamp. When a header lies or is misread, the description repeats the lie faithfully. The false positives chapter has a specimen row whose description is confident nonsense for exactly this reason.

Checking the scan against the manifest

Row by row, against the answer key:

Manifest Scan Verdict
SquashFS at 65536 Squashfs at 0x10000 found, offset exact
gzip at 69632 gzip at 0x11000 found, offset exact
gzip at 69776 gzip at 0x11090 found, offset exact
header at 0 — no signature exists for it; silence is correct
random at 69952 — random bytes match nothing; the entropy chapter reads this region instead
trap at 78144 — the plain scan hid it entirely — see below

Two honest wrinkles in an otherwise clean run:

The SquashFS "size" disagrees with the manifest. The member occupies 4,096 bytes in the image; the scan says 650 bytes. Both are telling the truth about different things. The superblock inside the filesystem records 650 bytes as the size of the filesystem's actual data; the builder padded the member to a 4 KB boundary when writing it into the image. Binwalk quotes the superblock. Whenever a description quotes a size, ask whose size it is.

The trap vanished silently. The bytes at 78144 really are gzip magic, but there is no valid stream behind them. Binwalk's signature for gzip does not stop at the magic: a validation step parses the header further, finds it wanting, and marks the result invalid — and the plain scan does not show invalid results at all. Nothing in the output says anything was suppressed. Remember that a clean scan table is a filtered table; the chapter on false positives shows how to lift the filter with -I, and what else was hiding in this same image.

Check: a scan you can trust is one whose offsets you can reconcile with something you know independently — a manifest, a partition table, a vendor's layout notes. Here all three real members agree to the byte, and the three silences each have a named reason. That reconciliation, not the table itself, is the result of a first scan.