Section 1.4

Trusted computing base (TCB)

Definition

The trusted computing base (TCB) for a security property is the set of hardware, software and configuration that the property depends on. If any part of the TCB behaves wrongly, through a bug or through compromise, the property can fail, and nothing else is relied on to stop that. Parts outside the TCB can misbehave in any way without breaking the property. Each property has its own TCB. Trusted here means relied upon, not trustworthy: placing a part in the TCB records a dependence, not a judgment of correctness.

The idea

A device runs small programs that it receives over the network, and claims: “an accepted program cannot change memory outside its own scratch area §2.24”. A verifier, a checker that inspects each program before acceptance, rejects every program that could write outside that area. Yet the claim depends on much more than the verifier. The interpreter §2.13, the code that executes the program, must run exactly the instructions the verifier inspected. Each helper function §2.19, a firmware function that programs are allowed to call, must write only where it promises. The bytes that were checked must be the bytes that run. The bootloader §6.30, which starts the firmware, must start the genuine firmware. The compiler that translated the firmware must have translated it faithfully. A flaw in any one of these breaks the claim, however perfect the verifier is.

The TCB is the list of those parts: everything someone would have to examine to be sure of the claim. A bank vault is a fair picture. The vault is safe only if the lock, the guards and every holder of the combination behave as they should, while the thousands of customers in the hall do not matter. The picture fails in one respect. A guard is trusted because someone judged the guard honest, but a component is in the TCB because the claim depends on it, whether or not anyone has examined it. Because every part of the TCB must be right, secure designs keep the TCB as small as they can.

How it works

Fix the property first, because the TCB belongs to one property, not to a whole system. Then:

  1. List every component involved in producing the protected behavior: hardware, firmware, libraries, configuration, keys, and the tools that built, installed and started them.

  2. For each component, ask the counterfactual question: if this component misbehaved in any way its access rights allow, while every other component behaved as specified, could the property fail?

  3. If yes, the component is in every TCB for this property; only adding a mechanism that confines it can take it out. A mechanism confines a component when the component cannot bypass the mechanism and the mechanism does not rely on the component working correctly.

  4. If no, this answer alone does not put the component outside the TCB. Take two separate checks that every request must pass: each blocks what the other wrongly lets through, so the answer for each check is no, yet the property can fail if both misbehave at once. Leave a set of components out only if the property holds when all of them misbehave at the same time while every component kept in behaves as specified; at least one of the two checks must therefore stay in.

  5. Treat a confining mechanism as a component in its own right: it joins the TCB in place of the code it confines.

Isolation is what keeps the TCB small. On a microcontroller §6.1 without memory protection, all firmware shares one address range, and any firmware function could, if faulty, write to any address. For a property about memory, every piece of firmware that runs is then in the TCB. A memory protection unit §6.8 (MPU), hardware that blocks accesses outside the address ranges permitted to the running code, confines the code running under it. Separate processes under an operating system confine code in the same way, and so does software fault isolation §2.41, which inserts address checks into the confined code. In each case the confined code leaves the TCB for that property, and the isolation mechanism and the code that configures it join the TCB.

Operating systems built on this idea, called microkernels §19.5.4, keep only a small kernel in the TCB for isolation and run device drivers §6.38 and services as isolated processes. The seL4 microkernel goes further: it has a machine-checked proof that its C code implements its specification.

Worked example

A program’s scratch area is 64 bytes, at offsets 0 to 63. The program calls a helper function fill(offset, n), which promises to write nn bytes starting at offset. The verifier checks the call fill(60, 4): the last byte written is at offset 60+4−1=6360 + 4 - 1 = 63, inside the area, so the verifier accepts. The verifier is right.

The helper has a bug: it always writes 8 bytes. It writes offsets 60 to 60+8−1=6760 + 8 - 1 = 67. The 67−64+1=467 - 64 + 1 = 4 bytes at offsets 64, 65, 66 and 67 lie outside the scratch area and overwrite whatever the firmware keeps there. The property fails although the verifier did its job. The helper alone, misbehaving, broke the property, so the helper is in the TCB for this property. Checking the verifier more carefully would not have helped.

Now take a logging function that prints each program’s result. Suppose it runs in the same address range as the interpreter and may write anywhere. A faulty logger could then overwrite the value in which the interpreter stores the end of the scratch area, after which the program’s writes are no longer confined. So the logger is in the TCB for the memory property, although it has nothing to do with running programs. If instead the logger runs as a separate process that receives results only as messages and cannot write the interpreter’s memory, it is outside the TCB for that property. It is still in the TCB for a confidentiality §1.8 property if the messages it receives can contain a secret key, because a faulty logger could print the key. One component can be inside the TCB for one property and outside it for another.

Two checks are not independent if they share a component. If the verifier and the interpreter both call the same function to decode instructions, a bug in that function can make both read the same program wrongly in the same way, and the second check catches nothing. The decoding function stays in the TCB however many checks call it.

Stated precisely

Let PP be a security property. A set TT of components is a trusted computing base for PP when PP holds in every execution in which every component in TT behaves as its specification says, whatever the components outside TT do within the access rights that the hardware and the isolation mechanisms leave them. The guarantee therefore has the form: if every component in TT meets its specification, then PP holds.

The counterfactual test follows from this definition. If a component xx, misbehaving alone while every other component meets its specification, can make PP fail, then xx belongs to every trusted computing base for PP: a set without xx would have to guarantee PP whatever xx does, and it cannot. Testing, review and formal proof raise confidence that the members of TT meet their specifications; they do not remove members from TT.

The term was standardized by the Trusted Computer System Evaluation Criteria (TCSEC), published by the United States Department of Defense in 1985 and known as the Orange Book [410]. The TCSEC defined the TCB as the totality of protection mechanisms within a computer system, including hardware, firmware and software, that together are responsible for enforcing a security policy.

Limits and common mistakes

Trusted does not mean trustworthy. Placing a component in the TCB says that the claim depends on it, and nothing about whether the component is correct.

Size is a proxy. A small TCB is easier to review, but small code can be wrong: one wrong comparison in a short routine that loads a key breaks the property as surely as a bug in a large component.

The build and boot chain are commonly forgotten. In his 1983 Turing Award lecture “Reflections on Trusting Trust”, published in 1984 [239], Ken Thompson described a compiler that inserts a hidden back door into the login program it compiles and, whenever it compiles a compiler, inserts the same trick into the new compiler, so that reading all the source code reveals nothing. For a property that relies on the compiled code, the argument must trust the compiler or check its output independently. A formally verified compiler such as CompCert reduces that risk; the proof’s specification and the tools that checked the proof then join the argument.

Suppose the claim is that only authorized firmware starts. In a signature-based secure boot §6.31 design, the boot code checks the next image against a trusted public key before starting it. That claim depends on the checking code, the trusted key and the hardware that protects both. A separate hardware rule, such as denying all application access to a fuse bank, can hold regardless of which firmware starts.

Configuration and keys belong to the TCB. A correct signature check that trusts the wrong public key enforces the wrong policy, so the people and processes that install keys and settings are part of the argument.

Questions answered

Does a helper, parser, allocator, compiler, or bootloader belong in the TCB?

Each of them belongs in the trusted computing base (TCB) for a security property whenever its misbehavior alone can make that property fail and no independent mechanism confines it. The TCB is the set of components a property depends on, so the answer is given property by property, not once for the whole system. For a typical device that runs downloaded programs:

A component leaves the TCB for a property only when a separate mechanism, which the component cannot bypass and which does not rely on the component, contains every effect of its misbehavior. That mechanism then joins the TCB in its place. Two separate checks that every request must pass each contain the other’s misbehavior, yet they cannot both leave the TCB. The TCB must guarantee the property even when every component outside it misbehaves at once, and the property can fail if both checks misbehave, so at least one of the two stays in.

Related entries: Helper contract (§2.21), Reference monitor (§1.17), Compiler correctness (§3.40), Root of trust (§1.33), Bootloader (§6.30), Secure boot (§6.31), Memory protection unit (MPU) (§6.8), Sandbox (§2.30), Software fault isolation (SFI) (§2.41). Further reading: [72, 156, 239, 410].