Posts Tagged ‘read arm chip protect software’

PostHeaderIcon Read ARM Firmware: Most of It Is Not Inside the Chip

When a board carries an ARM-based device, the instinct is to attack the device. That instinct is often wrong, and the reason is architectural: ARM cores are designed to run code from memory that is frequently not on the same die.

A large share of ARM systems use a microcontroller with internal flash, and a large share use a microprocessor or a ROM-based microcontroller that boots from an external SPI or parallel flash. In the second case the firmware is sitting in a commodity part with a datasheet, and the ARM device is merely the thing that executes it.

The two architectures

Architecture Where the image is Access route
Microcontroller with internal flash On the die Debug interface, or physical
Microprocessor with external boot device In a separate flash part Read the flash directly
Microcontroller with external QSPI flash In the external part, executed in place Read the flash, or capture the bus
SoC with ROM boot and encrypted image External, encrypted Key problem, not a read problem

The second and third rows are where most of the easy work is, and they are frequently overlooked because the ARM device is the conspicuous component.

Why the debug interface is closed

On a production device, the debug access port is either disabled by a protection setting or by blowing a one-time configuration. This is not a bug or a manufacturing mistake; it is the standard production procedure.

State Debug access Flash access
Fully open Read, halt, step Read and write
Read protection level one Refused, or restricted Refused, with an erase path
Read protection level two Refused permanently Refused permanently
Debug port fused off No response No route

The fourth row is the one that ends the conversation about the device itself. It does not end the conversation about the system, because the image may still be outside.

Reading the external device

An external flash on an ARM board is usually a standard part with a standard command set, and reading it requires no cleverness.

Package Method Note
SOIC or SOP8 Clip, in circuit Fastest; the bus must be quiet
WSON or BGA Desolder and read Requires rework equipment
QSPI in a multi-die package Desolder or probe Often shares a package with the ARM
On-package PoP Probe, or read through the ARM The most awkward case

The first row covers a surprising share of real boards, and it is worth trying before anything else. A clip on a SOIC flash takes seconds and requires no desoldering.

What the external image looks like

The image is not a raw copy of what the ARM executes. It has a structure defined by the boot mechanism and the linker.

Region Content
Boot header Entry point, image length, checksum
Vector table Initial stack pointer and exception vectors
Code Instructions
Read-only data Constants and tables
Initialised data Values copied to RAM at startup
Signature or digest If secure boot is used

The second row is the first thing to check, and it doubles as a validity test: the first word should be a plausible stack pointer, which on most ARM systems means an address in RAM near the top of the region.

Executed in place versus copied

This distinction determines whether the image can be used as-is.

Mode Where code runs Image requirement
Execute in place over QSPI From the external device Must be directly addressable
Copy to internal RAM then run From RAM Any format the loader understands
Copy to SDRAM then run From external RAM Requires SDRAM initialisation first
Staged by a boot ROM Depends on the ROM Format defined by the vendor

The second row produces images that are compressed or encrypted, because the loader is going to decompress them anyway. A high-entropy external image is a hint that the loader does more than copy.

The bus as an alternative route

Where the external device cannot be desoldered and cannot be clipped, the bus is often accessible, and a capture during boot reveals the image as it is fetched.

Situation Bus capture value
Execute in place, unencrypted The image, verbatim
Execute in place, encrypted in hardware Ciphertext only
Copy to RAM, unencrypted The image, as copied
Copy to RAM, decrypted by the ARM Plaintext, if decryption is on the external side

The fourth row is the useful one: if the ARM decrypts after fetching, the bus carries ciphertext. If a separate device decrypts before the ARM, the bus carries plaintext.

When the internal image is the only option

If the ARM device holds the only copy, the routes narrow to the ones that do not need cooperation.

Route Applicability
Debug interface, if left open Rare on production parts
Bootloader with a read command Occasional
Physical readout of internal flash General, expensive
Side channel against the copy routine Research-grade

The third row is the general answer, and its cost depends on the package and the process node. Extracting ARM MCU flash covers the protection levels and what each one costs to defeat.

What comes next

Once an image exists, validating it is the next step, and the two-word check described in reading ARM Cortex-M firmware settles whether it is loadable. The disassembly problems that follow are in reading ARM software.

Services at this boundary

Work covers architecture identification, external flash readout in circuit or in a socket, bus capture during boot, image validation, and internal readout where a route exists. It does not cover reading a device with the debug port fused off without a physical route, and it does not cover decrypting an image whose key is held inside a protected device.

The first question about an ARM board should be where the image lives, not how to open the chip.