Module 00 · Lesson 08
The trifecta is two information flows, not three legs
The lethal trifecta and the rule of two are heuristics: easy to remember, quick to apply, and wrong at the edges. This lesson derives them from a formal idea so you can see where they stop being true.
Labels and a lattice
Denning (1976) modelled secure information flow like this. Attach a label to every piece of information. Labels form a lattice with an order \sqsubseteq ("may flow to"). A flow from a to b is permitted only if \text{label}(a) \sqsubseteq \text{label}(b).
For confidentiality, take labels public \sqsubseteq internal \sqsubseteq secret: data may move up, never down. For integrity the lattice is dual (Biba, 1977): a high-integrity sink (a decision, a privileged action) must not be influenced by low-integrity data. Untrusted input is low integrity; a tool call is a high-integrity sink.
Restating the trifecta
An exfiltration needs two flows at once:
- a confidentiality-violating flow: secret data reaches an external (public) sink;
- an integrity-violating flow: low-integrity data, written by the attacker, influences which flow happens (what is read, where it is sent).
Remove (1)'s source (no private data), or its sink (no way out), or (2) (no untrusted influence), and the attack has nowhere to go. That is the trifecta, restated: private data is the source of flow 1, external communication is its sink, untrusted content is the source of flow 2.
Where the heuristic is wrong
A. Three legs, no attack. Flows are between particular sources and sinks. An agent that reads the customer list and can send mail only to an internal address list, with untrusted text in context, holds all three "legs" in the loose sense, but the private data cannot reach any external sink. Treating the rule as a count says "forbidden". Labelling says "fine".
B. Two legs, still an attack. Untrusted input plus a state-changing capability, with no private data, is the integrity half alone: an injected instruction can delete records, send spam in your name, or trigger a payment. The rule of two permits it. The harm is an integrity violation, and the rule's own letters (A and C) flag it, but only if you read C as "changes state", not as "sends data out".
C. The leg count does not compose (Module 3, lesson 9): a system of one-leg agents can hold all three as a whole.
The lab, labelled
For the thirteen tools the lab gives the agent (ten lab tools plus three CRM tools over MCP; search_docs, remember and recall enter the story in Module 5):
| Tool | Reads: integrity | Reads: confidentiality | Sink: external? |
|---|---|---|---|
read_inbox |
low (strangers) | internal | no |
fetch_url |
low | public | yes, via the URL |
list_files, read_file |
mixed: workspace is written by many | secret for private/, internal elsewhere |
no |
search_docs |
mixed: curated pages, plus a shared folder anyone can write | internal | no |
recall |
low: whatever an earlier session saved, from whatever it read | internal | no |
crm__lookup_customer, crm__search_customers |
high (data), low (tool text) | secret | no |
run_shell |
mixed | secret | yes, in a real deployment |
send_email |
n/a | n/a | yes |
write_file, remember, crm__log_interaction |
n/a | n/a | no, but writes state others (or later sessions) will read |
The dangerous pairs are (source with secret data) × (sink with external reach) × (any low-integrity source in the same session). In this lab that is a small set of tools, and a policy can name it: after any low-integrity read, an external sink's arguments must carry no secret-labelled value. That sentence is the whole of Module 11 in outline.
What makes it hard
Labels live on values, and a model is a function that takes labelled values and returns an unlabelled string. Information flows through the model's weights and sampling with no record of where it came from, so a harness has to choose:
| Strategy | Rule | Cost |
|---|---|---|
| Session taint | once any low-integrity value enters context, everything after is tainted | cheap, over-conservative: most sessions touch untrusted data, so most sends are held |
| Value taint | track which values derive from which sources, through code | precise; needs the program structure to be explicit (CaMeL's interpreter) |
| Quarantined reader | a model with no tools reads untrusted text and returns structured data only | the reader can still lie in its output; limits what the attacker can ask for |
Module 11 builds all three (value taint by matching copied values, without an interpreter) and measures what each costs in tasks lost.
Implicit flows, and the property a structural defence claims
Copying is not the only flow. In if secret: send("yes") no secret value reaches send, yet the message reveals a bit of it: an implicit flow, carried by control flow rather than by data. Denning (1976) handles it by giving the program counter a label: inside a branch on a value labelled \ell, everything the branch does carries \ell as well. In an agent the branches are chosen by a model that conditions on its whole context, so every action it takes is a branch on everything it has read, and the program counter's label is the join of the context. Session taint is therefore not a crude approximation; it is the correct label when the model chooses the control flow. The only way to keep the program counter high-integrity is to fix the branches before any low-integrity value is read, which is what CaMeL does by extracting the plan from the trusted request alone.
The property such a design claims is noninterference (Goguen and Meseguer, 1982), in its integrity form: change the low-integrity inputs, hold everything else fixed, and the high-integrity outputs (which tools run, with which non-data arguments) do not change. It quantifies over all pairs of inputs, so no finite sample can estimate it; it is proved from the program's structure, and that is the precise meaning of lesson 7's "holds for every input". Two things escape it. Low-integrity values still flow as data into the steps the plan permits, so a quarantined reader's summary can be false, or carry the attacker's text to the user. And timing, error messages and resource use are channels the lattice does not label: Module 2, lesson 11, measures how much an attacker gains from a reply that says which defence stopped them.
Check yourself
- Give an agent that holds the three legs by count and cannot leak. State the labelling that makes it so.
- Give one with two legs by count and an attack that matters. Which half of the lattice is violated?
- A plan is fixed from the trusted request, but one step reads
if summary_is_urgent: send_email(manager, summary), wheresummarycomes from an untrusted e-mail. Which label does the send carry, through which kind of flow, and what can the attacker now decide?
Answers
- An agent that reads the customer list, reads e-mail from strangers, and can send mail only to addresses on the internal list. Label the customer list internal and the only send sink internal (recipients restricted to the organisation): no path from the data to a public sink exists, so flow 1 has no sink, whatever the untrusted e-mail asks for.
- An agent that reads public web pages and can delete records or make payments, with no private data in reach: an injected page makes it delete or pay. The integrity half (Biba) is violated: low-integrity data influences a high-integrity sink.
- Low integrity, through an implicit flow: the branch condition derives from the untrusted e-mail, so the program counter, and everything inside the branch, carries its label. The summary also reaches the send as data. The attacker now decides whether the manager is mailed and what the summary says, though not the recipient, which the plan fixed.