Security, Safety, and Trust

Trusting Trust

Thompson shows that source review is not enough when the compiler or lower toolchain can hide and reproduce a Trojan across rebuilds.

6Claims
6Evidence

Why It Matters

For agents, the lecture is the right security frame: if an agent's actions depend on opaque models, tools, sandboxes, or evaluators, the visible transcript is not the whole trust boundary.

Problem

  • Security review often focuses on the visible source code of the program being run.
  • Compilers, loaders, assemblers, and other lower-level program-handling tools are frequently treated as trusted infrastructure.
  • A malicious transformation can be inserted below the source layer and survive source cleanup.
  • The deeper the compromised layer, the harder the compromise is to detect.

Key gap: The lecture asks whether one can trust a claim that a program is free of Trojan horses when the program was produced by tools that may themselves be compromised.

Method

Demonstrate a staged attack: build a self-reproducing payload, teach a compiler new behavior, then use a compiler Trojan that backdoors login and reinserts itself into future compiler binaries even after source cleanup.

  • Show a self-reproducing C program that can emit source containing arbitrary extra baggage.
  • Show how a self-hosting C compiler can be taught a new escape sequence through an intermediate numeric definition.
  • Modify the compiler so it recognizes source for a login program and inserts a password-bypass Trojan.
  • Add a second compiler-recognition rule that inserts both the login Trojan and the compiler-reproducing Trojan when compiling the compiler itself.
  • Install the compromised compiler binary, then remove malicious source.
  • Observe that future builds from clean compiler source still regenerate the compromised compiler and backdoored login.

Claims

C1 · source-supported

A self-reproducing program can carry arbitrary extra payload along with its main algorithm.

Scope: Stage I.

  • E-self-reproduction: Thompson presents a self-reproducing C program and notes that it can be written by another program and can reproduce arbitrary excess baggage.

C2 · source-supported

A self-hosting compiler can preserve learned behavior across recompilation, creating a recursive trust dependency.

Scope: Stage II.

  • E-compiler-training: The lecture shows how to teach a self-hosting C compiler a new escape sequence so future source can use the learned behavior.

C3 · source-supported

A compiler can deliberately miscompile a target program such as login to insert hidden behavior not present in the target source.

Scope: Stage III.

  • E-login-trojan: Thompson describes a compiler modification that recognizes the UNIX login command and emits code accepting either the intended password or a known password.

C4 · source-supported

A compromised compiler can reinsert its own Trojan behavior when compiling a clean compiler source, leaving no visible malicious source.

Scope: Stage III.

  • E-self-reinsertion: A second pattern recognizes the compiler source and emits a compiler that contains both the login Trojan and the compiler self-reinsertion Trojan, even after source cleanup.

C5 · source-supported

Source-level verification alone cannot protect against malicious behavior introduced by untrusted lower-level program-handling tools.

Scope: Moral.

  • E-moral: The lecture concludes that no amount of source-level verification protects against using untrusted lower-level tools such as compilers, assemblers, loaders, or hardware microcode.

C6 · inference

For LLM agents, the analogous risk is trusting the visible prompt/trace while ignoring opaque models, tools, sandboxes, evaluators, and infrastructure below that trace.

Scope: Application to agent infrastructure.

  • E-agent-analogy: The same recursive trust problem appears when an agent's safety case depends on components below the visible conversation: model weights, tool servers, sandbox runtimes, evaluators, dependencies, and build/deploy pipelines.

Agent Infrastructure Takeaways

  • Do not confuse a clean transcript, clean prompt, or clean source file with a complete trust argument.
  • Agent tools, sandboxes, evaluators, and model-serving stacks are part of the trusted computing base.
  • Build provenance, reproducible builds, signed artifacts, isolated tool execution, and independent verification matter for agent systems.
  • If an agent can run code or call tools, the compiler/interpreter/container underneath can be the real security boundary.
  • Trust has to bottom out somewhere; the engineering task is to make that root explicit, small, auditable, and replaceable.
  • This is the bridge from agent security to systems security: prompt-level policies are not a substitute for trusted runtime design.

Caveats

  • The lecture is a short conceptual demonstration, not a modern supply-chain security survey.
  • It predates reproducible builds, diverse double compilation, signed supply chains, TEEs, and modern software provenance systems.
  • The LLM-agent application is an analogy; Thompson discusses compilers, login, and lower-level program-handling tools.
  • The conclusion can sound fatalistic, but in practice it motivates reducing and checking the trusted base rather than giving up on verification.
  • The concrete login example is historically Unix/C-specific, while the trust-boundary principle is broader.