What Binwalk Is
A router, a camera, a printer, a cheap smart plug: each of them is a small computer, and each carries its whole software world in one file. That file is the firmware image. When the vendor ships an update, the update is the image: one download that contains, packed back to back, a bootloader, a Linux kernel, a whole root filesystem with every program and web page the device serves, and sometimes archives nested inside archives. One file, many files hidden inside it, at offsets nobody printed on the outside.
Binwalk is the tool that opens that file without running it. It walks the image byte by byte, comparing what it finds at each offset against a library of signatures — the characteristic first bytes, called magic bytes, that begin a gzip stream, a SquashFS filesystem, a tar archive, and several hundred other formats. Where the bytes match a known pattern, binwalk reports the offset and reads whatever the format's header has to say about itself. Then, if you ask it to, it carves the member out into a file of its own and hands it to the right unpacking tool — and it can recurse, scanning what it just extracted for further members hiding inside. Firmware people call that recursion matryoshka, after the nesting dolls.
Why open an image at all? Reasons people actually have:
- You own a device and want to know what is really running on it — what programs, what versions, what it phones home to.
- A vendor update arrived and you want to see what changed before you let it install.
- You are recovering files from a dead device, or checking an image before trusting it.
- You study how things are built. A firmware image is a whole small Linux system, laid out flat where you can read it.
Just as plainly, what binwalk is not:
- Not an emulator. It never runs the code in the image. Examining an image with binwalk is safe in the way reading a book is safe; the danger only starts if you run something you extracted (the extraction chapter is blunt about this).
- Not a decompiler. When you find a program inside an image and want to read what the program does, that is reverse engineering, and the tool for it is a disassembler — the companion guide Ghidra for Mere Mortals covers that job. Binwalk finds the program; it does not explain it.
- Not an oracle. A signature is a pattern, and patterns occur by accident. Every hit is a hypothesis that still has to be checked, which is why this guide spends a whole chapter on false positives.
The whole tool is three verbs, and the guide is organised around them. Scan: report the members and their offsets. Extract: carve the members out and unpack the ones it knows how to unpack. Recurse: scan the extracted pieces again, because firmware nests. Around those verbs sit the supporting crafts — reading an entropy plot to see where the compressed or encrypted regions are, knowing the usual filesystems by sight, and hunting for one specific thing instead of everything.
Check: the idea in one breath is one file in, a map of the members inside it, and the members themselves out — each one verified, none of it executed. If a scan result ever sounds more certain than that, the false positives chapter is the corrective.