Section 1.33

Root of trust

Definition

A root of trust is a component, key or stored value that a system trusts without checking it, and from which every later check starts. A typical root is boot code in ROM (read-only memory), which no software can change, together with a public key that this code uses to check the next program before running it. Every program checked this way is trusted only because the root is. Nothing inside the system verifies the root, so its correctness and protection must come from hardware design, manufacturing and review.

The idea

A device checks the digital signature §5.14 on its firmware before running it. A digital signature is a value that only the holder of a private key can compute and that anyone with the matching public key can check. The check needs two things: code that performs it, and a public key. If both sit in rewritable flash memory §6.6, an attacker who can rewrite flash replaces the checking code with code that accepts anything, or replaces the public key with their own. The check still runs and still says yes, so it proves nothing. Checking the checker with a second checker only moves the question: what checks the second checker?

The regress must stop at something that the system does not check and that is protected in another way. Chip makers stop it with boot code fixed in ROM during manufacture, which no software can rewrite, and with a key, or a hash of a key (a short fingerprint computed from the key), written into one-time programmable memory, whose bits can be set once and never cleared. That endpoint is the root of trust. Everything above it is verified; the root is assumed.

A chain hanging from a hook is a fair picture: each link holds only if the link above it holds, and the hook holds them all. Adding links never makes the hook stronger. The picture stops in two places. A real system usually has several roots for different jobs, for example one for checking updates and another for protecting secret keys. And a root need not be an object: the factory step that writes the first key into each device is part of the root too, because a mistake there is never checked afterwards.

How it works

Secure boot §6.31, a start-up process in which each program is checked before it runs, shows a root of trust at work.

  1. Manufacture. The chip maker fixes the boot code in ROM. After every reset, the processor starts executing there.

  2. Provisioning. In the device maker’s factory, a step called key provisioning §5.28, or enrollment, writes the device maker’s public key, or a hash of it, into one-time programmable memory. A hash is the fixed-length output of a cryptographic hash function §5.1. Storing the hash instead of the key saves scarce one-time programmable bits; the full key is then shipped in flash and checked against the stored hash. The same step usually sets a bit that switches signature checking on.

  3. Boot stage 1. The ROM code reads from flash the bootloader §6.30, the program that starts the main firmware, together with the public key and the bootloader’s signature. The ROM code hashes the public key and compares the result with the stored hash, then checks the bootloader’s signature with that key. If either test fails, the ROM code does not run the bootloader.

  4. Boot stage 2. The bootloader, now trusted, checks the signature on the application in the same way and runs the application only if the signature is valid.

Each stage extends trust to the next only by checking it before running it. The sequence is called a chain of trust, and its first link is the root.

What a root must provide depends on its job.

In public-key systems, the stored public key that a verifier starts from is called a trust anchor: a public key, together with data naming the authority it stands for, that the verifier accepts without checking it against anything else. A trust anchor is one kind of root of trust. The code that uses the anchor must be trusted as well, so the anchor alone is never the whole root.

Standards name roots by their function. The Trusted Computing Group, which specifies the Trusted Platform Module, a security chip used in personal computers, distinguishes a root of trust for measurement, which records a hash of each piece of software as it starts; one for storage, which protects keys; and one for reporting, which signs that record so that a remote party can check it. These three are the basis of measured boot and attestation §6.32. NIST Special Publication 800-193, on the resiliency of platform firmware, names roots of trust for update, for detection and for recovery [418].

Worked example

A device keeps in one-time programmable memory the SHA-256 §5.2 (Secure Hash Algorithm with a 256-bit output) hash HH of the device maker’s 64-byte public key PP. SHA-256 turns any input into 256/8=32256 / 8 = 32 bytes, so storing HH instead of PP halves the one-time programmable space needed, from 64 bytes to 32. Flash holds PP; a bootloader LL signed with the private key that matches PP; and an application AA whose signature LL checks. The ROM code RR computes the SHA-256 hash of the key it finds in flash, compares the result with HH, and checks the signature on LL with that key. Consider five attacks by someone who can rewrite flash but cannot change ROM or the one-time programmable memory.

  1. Replace AA with unsigned code. LL finds no valid signature and does not run the new code. Stopped.

  2. Replace LL with a bootloader that skips its check. The new bootloader has no valid signature under PP, so RR does not run it. Stopped.

  3. Replace PP with the attacker’s own public key P′P', and sign a new bootloader with the matching private key. RR hashes P′P', gets a value different from HH, and stops. To pass, the attacker would need a different key with exactly the same SHA-256 hash, which by the best known method takes about 22562^{256} attempts, far beyond any computer. Stopped.

  4. The factory never wrote HH. Suppose a device left the factory with its one-time programmable memory blank and signature checking switched off. The attacker writes the hash of P′P' and switches checking on. From then on the chain works perfectly: every stage is checked, and the chain faithfully runs the attacker’s code. The chain is intact; the root belongs to the attacker.

  5. The device maker’s private key leaks. The attacker signs a malicious bootloader with the real private key. RR accepts it, because the signature is valid under PP. The protection of the private key, often inside a hardware security module (a protected device that holds signing keys and never releases them), is therefore part of the root’s story, although that key is never on the device.

Attacks 1 to 3 are what the chain exists to stop. Attacks 4 and 5 succeed with every check working, because they attack the root, not the chain. Anything else that can change which code the device accepts belongs to the root in the same way: a spare key kept for emergencies, a recovery authority §1.46 (a key or procedure allowed to repair or replace a device’s software when normal updates fail), or a debug mode that boots unsigned code. Whatever can change the root is itself part of the root.

Stated precisely

Let S0,S1,…,SnS_0, S_1, \dots, S_n be the stages of a chain of trust, where S0S_0 is the root and each stage SiS_i with i≥1i \ge 1 runs only after stage Si−1S_{i-1} has checked it against a rule, such as “carries a valid signature under this public key”. The chain establishes a conditional claim. If

  1. the root S0S_0 runs first after every reset, performs its check without error, and cannot be modified;

  2. the key or value that the root uses is the one that the legitimate authority provisioned;

  3. each check correctly implements its rule, and the signature scheme is unforgeable, meaning that nobody without the private key can produce a valid signature on a new message except with negligible probability, a probability so small that it can be ignored;

  4. each private signing key is held only by its legitimate authority;

  5. nothing can change a stage between the moment it is checked and the moment it runs; and

  6. no path, such as a debug, recovery or fallback mode, runs a stage without its check,

then every stage that runs was approved by the authority behind the root.

The conclusion is “approved by the authority”, not “correct” or “free of bugs”. A signed program with a bug is still approved. Conditions 1 and 2 are the root of trust itself. Nothing in the chain checks them, and if either fails, the chain faithfully verifies against the wrong root.

Limits and common mistakes

Moving trust to a root does not remove trust; it concentrates it. The root belongs to the trusted computing base §1.4, the set of components that a security property depends on, of every property built on it.

Root of trust does not mean secret, and it does not mean tamperproof. A root public key must not be replaceable but may be public. Whether a root resists physical attack, such as a brief disturbance of the supply voltage that makes the ROM code skip its signature check, is a separate claim that needs evidence for the specific chip.

A root in ROM cannot be repaired. The boot ROM exploit published in 2019 under the name checkm8 [419] used a flaw in the boot ROM of several generations of Apple iPhone processors, and no software update could remove the flaw from the affected devices.

Changing a root needs its own rule. A design that can retire a compromised root key §5.25 needs a mechanism for it, for example several key slots, each of which can be permanently revoked, and whoever controls that mechanism is part of the root.

A chain of trust says what was allowed to start, not what happens afterwards. A program that passed its check at boot can still be exploited while it runs.

A root says nothing about the quality of what its authority approves. If the authority signs a harmful program, every device runs it.

Questions answered

What verifies the verifier or protects the first key?

Nothing inside the system verifies the first verifier: it is the root of trust, the starting point that every later check relies on and that is itself trusted without being checked. Every chain of verification must stop somewhere, because checking a verifier needs another verifier. Designs therefore make the first verifier and the first key as hard to change as possible, and establish their correctness outside the running system:

The answer must also name everything that can change or bypass the root: a spare or recovery key §5.31, a debug mode that boots unchecked code, a factory step that could be skipped, and physical attacks that make the boot code skip its check. Each of these is part of the root. A signature check later in the chain cannot make up for a first key that an attacker chose.

Related entries: Secure boot (§6.31), Recovery authority (§1.46), Root key and root seed (§5.25), Bootloader (§6.30), Measured boot and attestation (§6.32), Key provisioning (§5.28), Digital signature (§5.14), Trusted computing base (TCB) (§1.4). Further reading: [418, 419].