DEV Community

Cover image for What Is the Trusted Computing Base? The Code Your System Cannot Afford to Distrust
Aditya Sharma
Aditya Sharma

Posted on

What Is the Trusted Computing Base? The Code Your System Cannot Afford to Distrust

How many lines of code does your computer actually need to trust?

A modern system contains an enormous amount of software. Browsers, applications, libraries, drivers, system services, the kernel itself, firmware beneath the kernel, bootloaders beneath the firmware. Depending on how you count, the line total can reach tens of millions.

But not all of that code occupies the same position in your system's security architecture. Some of it processes data, renders interfaces, handles network requests. If it misbehaves or gets compromised, it can cause damage, but the security boundary itself may still hold. Other code enforces the security boundary. If that code misbehaves, the boundary can collapse in ways that no application-level protection can fix.

The second category is what security architects call the Trusted Computing Base.


What "Trusted" Actually Means

Before defining the TCB, it is worth being precise about what "trusted" means in a security context, because it is consistently misunderstood.

Trusting a component does not mean believing it is bug-free. It does not mean the component is immune to compromise. It does not mean the developers wrote it perfectly or that it will never have vulnerabilities.

It means something more specific and more consequential: the security architecture depends on that component behaving according to the assumptions the security model requires. If the component violates those assumptions, the security guarantees that rest on them may fail.

This is a technical relationship, not a moral judgment. A component is trusted not because it is perfect, but because the security policy requires it to behave correctly. The more central a component is to enforcing the security boundary, the more damaging its compromise can be, and the more carefully it needs to be treated.


What the Trusted Computing Base Is

The Trusted Computing Base is the set of hardware, firmware, and software whose correct behavior is necessary to enforce a system's security policy.

That definition contains several important qualifications worth unpacking.

First, it includes hardware and firmware, not just software. The mechanisms that enforce isolation, control access, and enforce boundaries often extend below the operating system.

Second, "correct behavior" is the operative phrase. The TCB is not the set of components that are most visible, most complex, or most frequently updated. It is the set that must behave correctly for the security policy to hold.

Third, the composition of the TCB is not universal. It depends on the system architecture, the threat model, and the specific security property in question:

                System Security Policy
                         |
                Trusted Computing Base
                         |
        ┌────────────────┼────────────────┐
        ↓                ↓                ↓
     Kernel          Hypervisor        Firmware
        ↓
  Security Mechanisms
Enter fullscreen mode Exit fullscreen mode

Different systems, different architectures, different threat models will produce different TCBs for the same or different security properties.


The Simplest Way to Think About It

The clearest way to identify whether a component belongs to a particular TCB is to ask a direct question:

"If this component were completely compromised, could the rest of the system still enforce this security property?"

If the answer is no, that component is likely part of the relevant TCB.

Some examples. If the operating system kernel controls process isolation, and a kernel compromise allows one process to read arbitrary memory from another, then the kernel is part of the TCB for that isolation property. If a hypervisor is responsible for keeping virtual machines separated from each other, and a hypervisor compromise allows code in one VM to affect another, then the hypervisor is part of the TCB for that isolation boundary.

The question is always relative to a specific security property. A component can be part of the TCB for isolation between VMs without being part of the TCB for protecting a specific file on a guest OS's filesystem. Different security properties may have different trusted foundations.


TCB Is Not the Same as Attack Surface

These two concepts are related but describe fundamentally different things, and conflating them creates confused security reasoning.

The attack surface of a system is the collection of interfaces, inputs, endpoints, services, and components through which an external party can interact with or influence the system. A web application with a large API surface has a large attack surface. A kernel with many system calls accessible to unprivileged users has a large attack surface.

The TCB is about what must behave correctly for the security policy to hold, not about where an attacker can interact with the system.

Attack Surface:
"Where can an attacker interact with the system?"

TCB:
"What must behave correctly for the security boundary to hold?"
Enter fullscreen mode Exit fullscreen mode

A component can have a large attack surface without being solely responsible for enforcing the core security boundary. A web application that processes user input is highly exposed, but if it is properly isolated by the kernel and OS, compromising it may not compromise the security boundary itself.

Conversely, a TCB component might have a relatively small external interface, but its correct behavior is still fundamental to the system's security guarantees.

Reducing attack surface and reducing TCB size are both valuable goals, but they are different goals that require different approaches.


Why Kernels Are Usually Part of the TCB

Kernels are almost always in the TCB for an operating system's core isolation properties, and the reason is structural.

The kernel controls or mediates virtually everything that matters to process isolation:

Application
     ↓
System Call
     ↓
Kernel
     ↓
Hardware / Resources
Enter fullscreen mode Exit fullscreen mode

Virtual memory isolation, process scheduling, filesystem access controls, permission enforcement, device access, system call handling. These are not applications that happen to run with high privileges. They are the mechanisms by which the security boundary is enforced.

A kernel that completely loses its integrity can undermine process isolation, memory separation, and permission checks simultaneously. It sits at the foundation of the security model.

This also illustrates why TCB and attack surface are different. Kernels often have large attack surfaces: many system calls, many code paths, complex subsystems. The kernel is in the TCB because of its role in enforcing security, not because of its size.


The Reference Monitor

The concept of a reference monitor is one of the foundational ideas in systems security, and it helps explain what we mean by "trusted" more precisely.

A reference monitor is a mechanism that mediates access to protected resources. For it to provide meaningful security guarantees, it must satisfy three properties.

Complete mediation. Every access to the protected resource must go through the reference monitor. If an attacker can bypass it, the mediation is not complete and the guarantee fails.

Tamper resistance. The reference monitor itself must be protected from unauthorized modification. A monitor that can be changed or disabled is not a reliable boundary.

Verifiability. The mechanism should be structured in a way that allows its correct behavior to be meaningfully analyzed. This is why size matters: a small, well-defined mechanism is much easier to reason about than a large, complex one.

The reference monitor concept points directly to why the TCB matters. The mechanisms that enforce security boundaries must themselves be trusted. Whatever protects and implements those mechanisms becomes security-critical.


Why a Smaller TCB Is Valuable

If the security of a system depends on the correctness of certain components, then the amount of code and infrastructure whose correctness you depend upon matters.

A large TCB means more code to audit, more assumptions to verify, more potential vulnerabilities in security-critical paths, and harder overall security reasoning. A smaller TCB, when achievable, means the trusted foundation is smaller and more auditable.

This is one of the motivations behind microkernel architecture. In a monolithic kernel, a large amount of code operates at the highest privilege level:

Applications
     ↓
Large privileged kernel (many services)
     ↓
Hardware
Enter fullscreen mode Exit fullscreen mode

In a microkernel approach, a small privileged core handles the most fundamental operations. Services like filesystems, device drivers, and network stacks run in user space with lower privileges:

Applications
     ↓
User-space services
     ↓
Small privileged core
     ↓
Hardware
Enter fullscreen mode Exit fullscreen mode

If fewer components run with the highest privilege, the question becomes whether fewer components need to be in the TCB for the core isolation mechanism. A compromised user-space device driver might affect its own operation, but if the core isolation mechanism is sound, it may not be able to directly violate isolation between unrelated processes.

Two important qualifications: moving a component outside the privileged core does not automatically remove it from every TCB. And a smaller TCB does not automatically mean a secure system. The components that remain in the trusted base still need to be correct. A small TCB can be valuable because it makes correctness more tractable, not because it substitutes for correctness.


Privilege and the TCB

Privilege and TCB membership are related but not identical.

A highly privileged component has greater ability to affect security boundaries if it behaves incorrectly. This is why privilege is often a useful proxy for TCB membership. But the relationship runs through the security model, not directly from privilege to trust.

A component can be security-critical without having conventional kernel-level privilege. A component that processes cryptographic keys in a security-sensitive context might be conceptually part of the TCB for the key-protection property even if it does not run in ring 0.

The practical implication: least privilege and TCB reduction reinforce each other. Giving each component only the privileges it needs reduces the potential damage from compromise. Reducing the number of components responsible for the core security boundary reduces the trusted foundation that must remain correct.


Virtualization and the TCB

Virtualization changes where some trust boundaries sit.

When a hypervisor is responsible for isolating virtual machines from each other, the hypervisor becomes part of the TCB for that isolation property:

Guest Application
     ↓
Guest OS
     ↓
Hypervisor
     ↓
Hardware
Enter fullscreen mode Exit fullscreen mode

A VM escape is the conceptual failure mode here: code in a guest VM interacting with the host or with other guests in ways the security model is supposed to prevent. If the hypervisor is compromised, the isolation boundary it enforces can be violated even if the guest operating systems themselves are intact.

Hypervisor security consequently receives serious attention from security researchers. It sits at the trust boundary between guest environments that may belong to different tenants, different security domains, or different trust levels.


Containers and What They Actually Trust

Containers are frequently discussed alongside virtual machines as isolation mechanisms, but their TCB is structured differently and importantly.

A virtual machine has a hypervisor between it and the hardware. A container shares the host kernel directly:

Container
     ↓
Container isolation mechanisms (namespaces, capabilities, seccomp)
     ↓
Host kernel
Enter fullscreen mode Exit fullscreen mode

The isolation between containers depends on namespaces (what a process can see), capabilities (what privileged operations it can perform), and seccomp (which system calls it can make). Each of these is a separate mechanism that contributes to the isolation model.

But all of these mechanisms are implemented and enforced by the host kernel. If the host kernel is compromised, the isolation guarantees that namespaces, capabilities, and seccomp provide can potentially be undermined, because those mechanisms are themselves implemented by the kernel.

This means the host kernel is part of the TCB for container isolation. This is a key difference from virtual machine isolation. A compromised guest OS in a VM with a sound hypervisor should ideally not be able to affect other guests. A compromised host kernel in a container environment potentially affects all containers on that host.

This is not an argument against containers. It is an accurate description of what must be trusted and at what scope.


Firmware and the Trusted Chain

Security assumptions can begin before the operating system starts.

Modern secure boot architectures establish a chain of trust rooted in firmware:

Hardware (firmware root of trust)
     ↓ verifies
Bootloader
     ↓ verifies
Kernel
     ↓ starts
Operating System
Enter fullscreen mode Exit fullscreen mode

Each stage verifies the integrity of the next before handing control over. The components responsible for establishing and maintaining this chain become security-critical. If the firmware performing the initial verification is compromised, the chain can be broken at its root, which is why firmware vulnerabilities are particularly serious: a persistent firmware compromise can survive operating system reinstallation and other remediation that operates at higher levels.


TCB vs TPM

These two things are often confused, and the confusion is understandable because both involve the word "trusted."

The Trusted Computing Base is a security architecture concept. It describes which components a system's security policy depends upon. It is an analytical category, not a specific piece of hardware or software.

The Trusted Platform Module is a specific hardware security component. It can store cryptographic keys securely, perform measurements of system state, attest to the state of a boot process, and perform certain key operations in a protected environment.

A TPM can be part of a security architecture that contributes to a trusted boot chain. It is not synonymous with the TCB. The TCB of a system using a TPM includes the TPM along with the firmware, bootloader, kernel, and other components the security model depends on. The TPM is one possible component in a TCB, not the TCB itself.


What Happens When a TCB Component Is Compromised

Understanding the consequence of TCB compromise makes the concept concrete.

Suppose an application running on a system is compromised. If the application is outside the TCB and the system's isolation mechanisms are sound, the damage is bounded. The application may be harmed, its data may be accessible to the attacker, but the security boundary may still protect other processes and the underlying system.

Now suppose the mechanism that enforces process isolation is compromised:

Process A
     ↓
Compromised isolation mechanism
     ↓
Boundary fails
     ↓
Process B may no longer be protected
Enter fullscreen mode Exit fullscreen mode

The security property that was supposed to hold no longer holds. The attacker has not just compromised one application. They have potentially compromised the assumptions on which the isolation of every application depends.

This is the fundamental difference. Compromising an application that is outside the TCB may violate application-level assumptions. Compromising a TCB component can undermine the foundation on which the security boundary itself is built.

Not every TCB compromise automatically compromises every security property on the system. A system may have multiple security properties with different TCBs. Compromising one trusted component may undermine some properties while others remain intact.


How Security Engineers Think About the TCB

When analyzing a system's security architecture, a few questions help identify the relevant TCB for a given property.

What security property am I trying to protect? What mechanism enforces it? What must that mechanism depend on to function correctly? If any of those dependencies are compromised, can the property still hold?

From there: can privileges be reduced so fewer components need broad access to security-critical mechanisms? Can the security-critical mechanism be made smaller or more explicitly defined to make its correctness easier to reason about?

This analysis makes security assumptions explicit. Hidden assumptions about what must be trusted are a common source of failures when those assumptions turn out to be wrong.


Common Misconceptions

Several confusions appear repeatedly when the TCB is discussed.

The TCB is just the kernel. Not necessarily. The relevant TCB depends on the security property and architecture. For VM isolation, the hypervisor is in the trusted foundation. For boot integrity, firmware may be. The kernel is commonly in the TCB but is not the whole of it.

A smaller TCB automatically means a more secure system. A smaller trusted base can make security reasoning more tractable and formal verification more feasible. It does not substitute for the correctness of what remains.

TCB means Trusted Platform Module. The TCB is an architectural concept describing which components a security policy depends on. The TPM is a specific hardware security component. They are different things, and a TPM can be one element within a system's TCB.

Everything in the attack surface is in the TCB. Attack surface describes where an attacker can interact with a system. The TCB describes what must behave correctly for the security boundary to hold. They overlap in some places and diverge in others.

If an application is compromised, the TCB is compromised. Not necessarily. A properly isolated application can be compromised while the underlying security boundary remains intact. This is what isolation mechanisms are designed to achieve.


The Foundation That Security Stands On

Security is not only about what you protect. It is also about what you have no choice but to trust.

Every security boundary rests on assumptions about how certain components behave. The TCB is the collection of components on which those assumptions ultimately depend. Some of those components are visible: the kernel, the hypervisor. Some are less visible: firmware, hardware mechanisms, the verification chain that starts before the OS loads.

A well-designed security architecture makes trust explicit. It asks which components must behave correctly and tries to limit that set to what is strictly necessary. It applies privilege minimization to reduce the components that could undermine the boundary if compromised. It structures security-critical mechanisms to be small enough to audit and clear enough to reason about.

The goal is not to trust nothing, which is impossible. The goal is to trust as little as necessary, understand clearly what is being trusted, and protect those trusted components accordingly.

Top comments (0)