Lesson 9 of 13 · 15m
Tearing Down the Rootfs
Vendor update files are archives; binwalk, unsquashfs, and ubi_reader turn them into a credential and misconfiguration hunt.
The .bin is a filesystem
The firmware update on the vendor's CDN is not an opaque blob — it is a container that mostly wants to open. binwalk -e firmware.bin walks the image by signature: u-boot legacy uImage headers, hsqs for SquashFS, UBI# for UBI volumes on raw NAND, 0x1985 JFFS2 magic, cpio archives, gzip streams, and the HDR0 of a TRX header. binwalk -Me recurses. From there each piece has a dedicated tool: unsquashfs -d rootfs/ for SquashFS, ubi_reader for UBIFS, jefferson for JFFS2, plain cpio -idm for initramfs archives. The MTD layout itself is often printed in the device's own boot log — Creating 7 MTD partitions on ... — and mirrored in /proc/mtd on a running device. If binwalk stalls on proprietary wrappers, fall back to carving by magic offsets and entropy analysis (binwalk -E plots it; high-entropy blocks are compressed or encrypted, low ones are raw config).
Two wrinkles appear the moment binwalk returns nothing. Vendor-mangled SquashFS — nonstandard LZMA, shifted magics — defeats stock unsquashfs; sasquatch is the fork built for exactly those mutations. Genuinely encrypted images announce themselves as one solid high-entropy block with no filesystem magic in strings — for which the embarrassingly effective answer is that the decryption key usually sits in an older release of the same firmware.
What you find inside follows a depressingly stable pattern. /etc/passwd and /etc/shadow with DES or md5crypt hashes — hashcat mode 1500/500, often cracked against a dictionary in minutes because the password was set by a factory script in 2014. SSH host private keys under /etc/dropbear — the same private key in every unit shipped, the "house keys" finding SEC Consult quantified in 2015 across hundreds of thousands of devices: one image download gives you the private half that impersonates the fleet. grep -r "PRIVATE KEY" in the extracted tree runs this check in one line. telnetd launched by init conditioned on an nvram flag. Hardcoded credentials in startup scripts and web interface configs. The public key the updater uses to verify signatures is legitimately in the image; the problem is when the image also reveals that verification lives in a component the update path can itself replace. Two more free wins: strings on the kernel and busybox binary recover version numbers you can match against the CVE list — most embedded kernels are years behind — and init scripts typically name the update server URL, the check interval, and occasionally a provisioning credential.
The wrong mental model
"Encrypted/proprietary firmware means opaque." Most vendor 'encryption' is a signature check or a mild obfuscation; the payload underneath is still a filesystem. And on the running device, the filesystem is mounted: /etc, /var on the jffs2 overlay, /tmp. Physical access plus a UART console is a full copy of everything — and where static analysis fails, firmware-analysis-toolkit and similar rigs run the image under qemu so you can poke the web UI and daemons on a live instance.
The real-world proof is Mirai, which did not exploit a vulnerability — it logged into telnet with factory credential pairs read out of exactly these files, sixty-plus pairs covering most of the IoT market, and took down Dyn in October 2016. The SerComm TCP 32764 backdoor on SerComm-built Linksys and Netgear gear was discovered the same way: dump the image, find the listener nobody documented.
What to actually do
On the audit: extract, then automate — firmwalker, EMBA, FACT, or unblob run the credential/key/cert hunt systematically, and every shared secret is a fleet finding, not a unit finding. The nvram/config partition deserves the same attention as the rootfs: it is usually a raw JFFS2 or flat key-value store — on a live device the same partitions come straight off /dev/mtd* (nanddump for NAND, dd on /dev/mtdblock* for NOR) — and it is where per-device Wi-Fi keys, provisioning tokens, and feature flags accumulate in plaintext. On the ship side: per-device credentials provisioned at first boot or fused in the factory, never a shared private key in the image; telnet gone, dropbear keyed per device; and read your own firmware the way an auditor does before you ship it — because they will.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
Januscape: A 16-Year-Old Linux KVM Escape Bug
CVE-2026-53359 lets a guest VM crash or potentially root your Proxmox host, and it hid in KVM's shared code for 16 years. What to patch and how to check.
The CPU-ocalypse Is Here, and the AI Industry Walked Right Into It
For three years the AI industry watched GPUs. Nobody was watching the CPU. Now Intel is warning of six-month lead times, AMD has blown past expectations, and the chip everyone assumed would always be available has become the new bottleneck in the biggest infrastructure buildout since the internet.
The RAMpocalypse! How AI Companies Are Destroying the Hosting Industry and Your Wallet
How AI infrastructure demand is driving up VPS and dedicated server costs — and why your hosting bill is going up even though you haven't changed anything.
Getting Started with Embedded C
The Goal By the end of this tutorial, you will be able to compile a binary written for the avr instruction set targeting the AtMega328P microcontroller on an Arduino Nano or Arduino Uno R3 form factor. Needed Documentation * Arduino Nano PCB design * Atmega328P datasheet Materials used * Arduino Nano * Arduino Uno R3 * Relevant cable * Computer Software Used * make (for easy of compiling and building) * avr-gcc (our compiler for avr ISA) * binutils-avr * avr-libc * avrdude (