Full name: Access port protection.
Definition
APPROTECT (access port protection) is the mechanism in Nordic Semiconductor’s nRF52 chips that stops an external debugger from reading or writing the chip’s memory and from controlling its processor. Debug access protection is the general name for such mechanisms. A debugger reaches the inside of a chip through access ports, gateways behind the debug pins. APPROTECT closes the gateway to memory and processor and leaves open a control gateway whose main power is to erase the whole chip. Firmware running on the chip keeps full access to memory.
The idea
A product is sold with a chip on a circuit board, and the board often still carries the debug connector used during development. Without protection, anyone who opens the case and connects a debug probe, a small adapter between a computer and the chip’s debug pins, can copy the whole flash memory §6.6 within seconds: the firmware, which may be a trade secret, and any keys stored with it. The same probe can write new firmware. During development this access is essential; in the field it is a door that should be locked.
A locked chip must still be reusable, for example when a production batch must be reprogrammed or a chip with broken firmware must be repaired. Nordic’s answer is to leave open one door that destroys what it would reveal: the control gateway can erase the whole chip, and only after the erase does the chip let the debugger in again. A safe-deposit box whose emergency opening shreds its contents first is a fair picture. The picture stops in two places. The shredding covers only this chip’s memory, not copies of the data kept elsewhere. And the emptied box can be used again by anyone, with new contents.
How it works
The parts, in the order a debug request passes them:
The debug probe, connected to the chip’s SWD §6.25 (Serial Wire Debug) pins, a two-wire debug interface defined by Arm.
The debug port, the chip’s end of that interface, which forwards each request to one of several access ports.
The AHB-AP (Advanced High-performance Bus access port), Arm’s standard access port to the chip’s memory bus and to the processor’s debug registers. Through it a debugger reads and writes memory, halts the processor and sets breakpoints §14.29, addresses at which the processor stops.
The CTRL-AP (control access port), Nordic’s own access port. Its registers reset the chip (
RESET), start an erase of everything (ERASEALL), report the progress of that erase (ERASEALLSTATUS) and report whether protection is active (APPROTECTSTATUS).
Access port protection blocks the AHB-AP. It never blocks the CTRL-AP.
Older revisions of the nRF52 chips decide from one word of the UICR (User Information Configuration Registers) §16.1, the chip’s region of non-volatile settings, called UICR.APPROTECT. In its lowest byte, the erased value 0xFF means disabled, and writing 0x00 enables protection from the next reset on. Protection then applies at every reset for as long as that word says enabled. A debugger can change that only with the CTRL-AP erase-all command, which erases flash, UICR and RAM. Erased UICR means disabled, so the debugger then has full access to an empty chip.
In June 2020 a security researcher published a voltage-glitching attack that brought back debug access on protected nRF52 chips [462]: a brief, precisely timed disturbance of the supply voltage during start-up made the chip misread its protection setting. Nordic Semiconductor confirmed the weakness, and later revisions changed the design. On revision 3 of the nRF52840 §6.4, whose build codes, part of the marking on the chip’s package, have the form Fx0, protection is on after every reset by default. The access port opens only when UICR.APPROTECT holds 0x5A, which Nordic calls HwDisabled, and the firmware, during its start-up, writes 0x5A to a register named APPROTECT.DISABLE. Firmware can also write 0x00 to APPROTECT.FORCEPROTECT to keep the port closed until the next reset. After a CTRL-AP erase-all, the debugger has access until the next pin reset, power-on reset §6.17 or brownout reset (a reset caused by a dip in supply voltage), which gives a programming tool a window in which to write new firmware and UICR settings.
Recovery is thus made destructive, not authorized: anyone with the debug pins can erase the chip, and no one can open it without erasing it. Other chip families authorize recovery instead. There the debugger must answer a cryptographic challenge from the chip with a key or signed certificate that the product maker controls, a scheme called authenticated debug; Arm publishes a specification for it named Authenticated Debug Access Control. Some chips also offer a permanent lock that no command lifts.
Worked example
A protected nRF52840 of revision 3 runs firmware that does not open the access port. Each request below is either refused or allowed:
A debugger, through the AHB-AP, reads flash at address
0x00000000: refused.A debugger, through the AHB-AP, halts the processor: refused.
A debugger, through the CTRL-AP, reads
APPROTECTSTATUS: allowed; it reports that protection is enabled.A debugger, through the CTRL-AP, starts the erase-all: allowed. Flash, UICR and RAM are erased; then the AHB-AP is open until the next pin, power-on or brownout reset.
The firmware reads its own key from flash: allowed.
The firmware sends memory contents over its radio in reply to a command: allowed, if the firmware has such a command.
Only the first two rows keep the key away from the debugger. The last two rows show that the key stays within reach of whoever controls the firmware or its commands.
Whether the port opens on revision 3 depends on two values, given here as the lowest byte of each register, the part that holds the setting:
UICR.APPROTECT=0x5A, and the firmware writes0x5AtoAPPROTECT.DISABLE: open after start-up.UICR.APPROTECT=0x5A, and the firmware writes nothing: closed. This happens, for example, with firmware built by tools older than revision 3, which do not know the new register.UICR.APPROTECT=0x00: closed.
On an older revision, UICR.APPROTECT = 0xFF, the erased value, gives open and 0x00 gives closed; the firmware plays no part.
Stated precisely
Describe the permissions as a set of pairs (actor, operation) that the chip allows. With protection active, contains no pair whose actor is a debugger using the AHB-AP. It contains the pairs (debugger through the CTRL-AP, reset), (debugger through the CTRL-AP, erase all) and (debugger through the CTRL-AP, read status), and every memory read or write that the firmware itself performs. Removing the debugger’s pairs removes none of the firmware’s pairs.
The contract has three parts.
From reset until the port is opened, every AHB-AP request is refused.
The erase-all command opens the AHB-AP only after flash, UICR and RAM have been erased.
Apart from the erase-all, the AHB-AP opens only when the configured values allow it at reset: on older revisions, when
UICR.APPROTECTdoes not enable protection; on revision 3, whenUICR.APPROTECTis0x5Aand the firmware has written0x5AtoAPPROTECT.DISABLEsince that reset.
The contract assumes that the protection logic works as designed, in particular that no disturbance of voltage, clock or electromagnetic field makes it misread its setting; that the erase completes before access is granted; and that the firmware offers no route to the protected data. It is a permission rule, not a measured strength: it states no probability that a physical attack fails.
Limits and common mistakes
Firmware keeps full access. A boot loader §6.30 that installs firmware without checking its signature, a debug command left in production firmware, or a memory-safety bug that lets an attacker run code bypasses access port protection completely.
Physical attacks are outside the contract. The 2020 glitching attack worked on chips with protection enabled. Revision 3 adds measures against that technique. This is not a claim of resistance to every fault attack, a deliberate disturbance that makes the chip misbehave, or to every side-channel attack §1.29, which reads secrets from power use, emissions or timing.
Destructive recovery protects the contents, not the hardware. Anyone with the debug pins can erase a protected chip and install their own firmware. The chip then keeps its factory identifier but has none of its old keys, so servers must recognize a device by its key, not by its identifier.
On revision 3 the access port is open from a CTRL-AP erase-all until the next pin, power-on or brownout reset. A production line that programs a chip in this window and wants it protected must install firmware that does not open the port, and must then reset the chip.
Protection depends on the chip revision. Read the build code printed on the chip and the product specification of that revision before writing any protection value.
Access port protection blocks the debugger’s route to memory. It does not encrypt the flash: memory read by any other route shows its plain contents.
Questions answered
What access remains possible, and how is recovery authorized or made destructive?
With access port protection active on a Nordic nRF52 chip, an external debugger can still use the CTRL-AP (control access port): it can reset the chip, read whether protection is active, and start an erase of the whole chip. It cannot read or write memory or halt the processor, because the memory access port, the AHB-AP (Advanced High-performance Bus access port), is closed. Inside the chip nothing changes: firmware reads and writes all memory, and every interface that the firmware offers, such as a boot loader, an update service or a diagnostic command, remains a route to the data. Physical attacks such as voltage glitching are outside the protection’s contract.
Recovery is made destructive, not authorized. No secret is needed to start it, but the erase-all command wipes flash, the UICR (User Information Configuration Registers) settings and RAM before the debugger regains access, so whoever recovers the chip gets an empty chip, not its contents. On revision 3 of the nRF52840 the reopened port stays open only until the next pin, power-on or brownout reset. Chips that authorize recovery instead make the debugger answer a cryptographic challenge with a key or certificate that the product maker controls, a scheme called authenticated debug.
Related entries: SWD (§6.25), J-Link (§6.27), Threat model (§1.2), Readout protection (§16.5), ERASEALL and destructive debug recovery (§16.6), UICR (User Information Configuration Registers) (§16.1). Further reading: [55, 57, 462].