Firmware Acquisition
Firmware Reverse Engineering · Embedded Systems & Firmware track
5 min read
In this module
Getting the Firmware
Before you can analyse firmware, you have to get hold of it. Acquisition is step one in any embedded security assessment, and difficulty runs the full spectrum — from clicking a download link on the vendor's website all the way to specialised hardware and physical access to the device.
Downloading from Vendor Sites
Many vendors publish firmware update files on their support pages. These are the easy mode of acquisition and give you a clean baseline for analysis. Router makers (TP-Link, Netgear, D-Link), IP camera vendors, and IoT device makers all routinely post firmware updates as downloadable files.
What you download might be a raw firmware image, a compressed archive containing one, or an encrypted update package. Encrypted bundles take more work: hunting down a decryption key (sometimes hiding in plain sight in an older, unencrypted version) or falling back on hardware extraction methods.
UART Shell Access
Plenty of embedded devices leave a UART console exposed on the PCB. Solder onto it during boot and you'll often land in a root shell or a bootloader console:
# Connect to UART using screen or minicomscreen /dev/ttyUSB0 115200
# Or using minicomminicom -D /dev/ttyUSB0 -b 115200
# From the device's root shell, dump flash contentsdd if=/dev/mtd0 of=/tmp/bootloader.bindd if=/dev/mtd1 of=/tmp/kernel.bindd if=/dev/mtd2 of=/tmp/rootfs.bin# Transfer files via tftp, scp, or serial (sz/rz)
# /tmp is usually a small tmpfs in RAM, so a big partition may not fit.# Stream it off the device instead (on your machine first: nc -l -p 4444 > rootfs.bin)dd if=/dev/mtd2 | nc 192.168.1.10 4444UART pins are usually exposed as a row of 3-4 pads or a header on the PCB. Use a multimeter to identify GND (continuity to ground plane), VCC (3.3V or 5V; never connect it to your adapter), TX (voltage fluctuations during boot), and RX (idle high). A logic analyser or oscilloscope confirms the signal and helps determine the baud rate.
JTAG/SWD Extraction
JTAG and SWD are debug interfaces that give you direct access to the MCU's memory and flash. With OpenOCD or J-Link:
# Connect via OpenOCD and dump flashopenocd -f interface/jlink.cfg -f target/stm32f4x.cfg# In OpenOCD console:haltdump_image firmware.bin 0x08000000 0x100000JTAG/SWD extraction still works when UART is disabled and the device's software interfaces are otherwise locked down. The catch: plenty of devices ship with readout protection enabled, which blocks debug access to flash memory.
SPI Flash Dumping
Many devices stash their firmware in an external SPI flash chip. Given physical access, you can read it straight off the board:
# Read SPI flash with a CH341A programmer and flashromflashrom -p ch341a_spi -r firmware_dump.bin
# Verify by reading twice and comparing hashesflashrom -p ch341a_spi -r firmware_dump2.binsha256sum firmware_dump.bin firmware_dump2.binA SOIC-8 test clip lets you read the flash while it's still soldered to the board. If that doesn't work, desoldering is always an option. In-circuit reads sometimes fail because the MCU is fighting you for the bus; holding the MCU in reset usually fixes it, and pulling the chip off entirely is the last resort.
Cheap CH341A programmers are notorious for driving the SPI data lines at 5 V even when the chip is powered at 3.3 V, which can kill the flash; measure yours or apply the well-documented fix first. Plenty of newer flash parts run at 1.8 V and need a level-shifting adapter. Check the pinout in the chip's datasheet and line the clip's pin 1 up with the dot on the package. And unplug the device first: anything with a mains power supply can hold dangerous voltages on its primary side for a while after you pull the plug.
Chip-Off Techniques
When firmware lives in integrated flash inside the SoC package, with no external flash and every debug interface locked, you reach for chip-off: physically removing the flash and reading it with a specialised reader.
BGA (Ball Grid Array) packages make that a fiddly job. You need a rework station for desoldering, reballing kit for laying down fresh solder balls on the chip's pads, and a BGA adapter for the chip reader. The procedure destroys the original device, which is sometimes the only way into a fully locked-down target.
Choosing Your Approach
The acquisition method depends on the device's security posture:
| Device Security Level | Recommended Approach |
|---|---|
| No protection | Vendor download or UART shell |
| UART disabled | JTAG/SWD extraction |
| Debug ports locked | SPI flash dump (if external flash) |
| Readout protection enabled | Fault injection to bypass RDP, then JTAG |
| Fully integrated, locked | Chip-off or side-channel key extraction |
The same table as a decision path, with a rough idea of what each step costs and how much it risks the device:
Every method asks for its own tools and skills. Start cheap, escalate only when you have to.
Firmware acquisition and analysis may be subject to laws like the DMCA (Digital Millennium Copyright Act) in the US or equivalent legislation elsewhere. Security research exemptions exist in many jurisdictions, but the legal landscape varies. Always understand the legal framework in your jurisdiction before performing firmware extraction and analysis.