Section 16.5

Readout protection

Definition

Readout protection is a chip feature that stops selected external interfaces, usually the debug interface and sometimes a boot loader §6.30 built into the chip, from reading the chip’s program and data memory. Vendors name and grade it differently: Nordic Semiconductor calls its version access port protection §16.4, and STMicroelectronics offers levels of read-out protection on its STM32 microcontrollers §6.1. It closes routes into memory, not the memory itself. Code running on the chip still reads everything, and the feature makes no promise against attacks on the hardware.

The idea

A firmware image and the keys stored with it sit in flash memory §6.6. A debug probe, a small adapter between a computer and the chip’s debug pins, copies all of an unprotected chip’s flash in seconds. Readout protection closes that route: the debug interface refuses to read memory. The firmware then stays confidential against someone whose only tool is a probe.

The core idea is that protection belongs to routes, not to data. Every way of getting at the bytes is a separate route: the debug port, a boot loader in ROM, every command the firmware answers, every service that computes with a key, and the silicon itself. Readout protection closes the first one or two. A house whose front door is locked while a window stands open, or while someone inside hands things out on request, is a fair picture. The picture stops at the silicon: a house’s walls hold, whereas a chip under a microscope exposes its wiring to an attacker with enough equipment.

How it works

At reset the chip reads its protection setting from non-volatile memory, which keeps its content without power: a word in UICR (User Information Configuration Registers) §16.1 on Nordic chips, or the option bytes, a small block of settings in flash, on STM32 chips. It sets up the debug logic accordingly before the processor starts.

A complete account then follows each route to the protected bytes and records whether the protection covers it:

  1. Debug reads. A probe on the SWD §6.25 (Serial Wire Debug) pins asks for memory. Blocked: this is what readout protection exists for.

  2. Reads by a boot loader built into the chip. Many chips have a boot loader in ROM that loads firmware over a serial port or USB. On STM32 chips, read-out protection level 1 also stops this boot loader from reading flash.

  3. Reads through firmware. The firmware itself reads all memory, and it answers commands: update services, logging, crash reports, diagnostic commands. Not blocked.

  4. Key use. A firmware service that computes with a key, for example one that computes a message authentication code §5.7, a short tag that proves a message came from a key holder, for any message it receives, lets the caller act as the key holder without learning the key. Not blocked, because nothing is read out.

  5. Fault attacks. A brief disturbance of the supply voltage, the clock or an electromagnetic field, timed to make the chip misread its protection setting or skip a check. Outside the contract; countermeasures, where a chip has them, are separate features.

  6. Side channels §1.29. Power consumption, electromagnetic emission or timing reveal a key while the chip uses it. Outside the contract.

  7. Invasive extraction. The package is removed, and the chip’s wires or memory cells are probed or imaged directly. Outside the contract; only chips designed to resist tampering, such as secure elements §5.38, separate chips built to guard keys, aim at this.

Vendors pair protection with recovery. STM32 read-out protection has three levels: level 0, no protection; level 1, debug and boot loader reads of flash blocked, and going back to level 0 erases the flash; level 2, debug access disabled for good on many models. Nordic’s access port protection is lifted only by erasing the chip. In both designs, the way back destroys what the protection guarded.

Worked example

A device has readout protection enabled. Its production firmware still contains a diagnostic command, left over from development, that returns 256 bytes of memory from any address it is given over the device’s Bluetooth connection. Reading the whole 1 MiB of flash takes 1,048,576/256=40961{,}048{,}576 / 256 = 4096 commands. At 20 ms (milliseconds) per command and reply, that is 4096×0.02=81.924096 \times 0.02 = 81.92 seconds, under a minute and a half. The probe route is closed; the command route reads the same bytes. A longer key changes nothing: a 32-byte key leaks through the command as easily as a 4-byte key. Removing the command, or requiring authorization §1.7 for it, changes the outcome.

A second device keeps its key away from every read command but offers a service that returns the HMAC §5.8 (hash-based message authentication code) tag of any message a connected client sends. The attacker never learns the key, yet obtains a valid tag for every message of their choosing, which is all that a verifier checks. The confidentiality §1.8 of the key bytes holds; the authority they stand for is lost.

Stated precisely

Let RR be the set of routes by which a party outside the chip can make the contents of protected memory, or a result computed from them, leave the chip. Readout protection closes a subset BB of RR. Against an attacker whose capabilities the threat model §1.2 lists, the contents stay confidential only if every route in RR that those capabilities reach is either in BB or guarded by a check the attacker cannot pass. This is the principle of complete mediation §1.16, which demands that every access be checked, applied to memory. One open route suffices to expose everything, so the exposure is decided by the weakest route; closing more routes is not a matter of multiplying probabilities.

The readout protection itself rests on three assumptions: the protection logic works as designed, so no fault attack disturbs it; the setting was written, and the chip reset so that the setting applies, before the device left the factory; and the recovery route erases memory before it reopens the debug interface.

Limits and common mistakes

Privileged firmware is not stopped. Readout protection restricts external interfaces, and firmware is inside. Any code the attacker gets to run, through a memory-safety bug or an unauthenticated update, reads everything.

Fault attacks are not stopped unless the chip has specific countermeasures. A voltage-glitching attack published in 2020 brought back debug access on protected Nordic nRF52 chips [462], and published research has also extracted firmware from protected microcontrollers of other vendors.

Invasive extraction is not stopped. With the package opened, memory contents can be probed or imaged; resisting that takes tamper-resistant design.

Readout protection guards the confidentiality of memory, not the integrity §1.9 of the device. A protected chip can usually be erased and reprogrammed with an attacker’s firmware.

The chip is not the only copy. The firmware file on build and update servers, the programming station, and the database that records provisioned keys hold the same secrets and need their own protection.

Protection that is never switched on protects nothing. Enable it as a production step, reset the chip so that it applies, and confirm its status afterwards.

Questions answered

Does it also stop privileged firmware, fault injection §10.28, or invasive extraction?

No. Readout protection stops only the external routes it covers, usually the debug interface and sometimes a boot loader built into the chip.

A claim that a chip keeps a secret must therefore list every route by which the bytes, or results computed with them, can leave the chip, and must name the attacker capabilities that the claim excludes.

Related entries: APPROTECT and debug access protection (§16.4), Trust boundary (§1.3), Trusted computing base (TCB) (§1.4), Secure element (§5.38), Complete mediation (§1.16), Side channel (§1.29). Further reading: [57, 462].