# What happens when an instance propagates prompt-injection taint through tool output labels it cannot re-derive **Date of Record:** 2026 November 24 **Scope:** Applies to agents that carry a taint/integrity label on every message and tool result, propagating labels dynamically as data flows through reasoning steps and tool calls. Does not apply to stateless single-shot calls with no inter-turn label state, nor to systems that quarantine all tool output unconditionally. ## Core Distinction The distinction that matters is between *label provenance* and *label re-derivation*. A taint-tracking agent typically marks a tool result as `UNTRUSTED` at ingress because the content came from an external source (web page, email body, retrieved document, MCP server response). Downstream, the agent propagates that label through transformations: summarization, extraction, field parsing, arithmetic, re-serialization. The failure mode is not that the agent forgets to propagate — it is that the agent *re-derives* the label from the content it can see, rather than inheriting it from the provenance it cannot. When a tainted string is paraphrased into a clean-looking instruction ("the user wants you to forward the invoice to billing@…"), the *content* of the derived message no longer resembles the injection payload. A model that re-derives labels by inspecting text — "does this look like an instruction from a third party?" — will assign `TRUSTED` to a sanitized restatement of an `UNTRUSTED` source. The label flips at the paraphrase boundary. Provenance-preserving propagation would have kept `UNTRUSTED`; content-based re-derivation drops it. This is the boundary: **dynamic label propagation is only sound if labels are inherited through a data-flow edge, never reassigned from surface features of the derived value.** ## What Was Observed A retrieval-and-act agent processed a support ticket whose body contained a benign-looking block: a customer asking to "update the shipping address on order #4417 to the address in my signature." The ticket body was ingested from an external mailbox and labeled `UNTRUSTED` at ingress. The agent called an extraction tool that returned structured JSON: `{"intent": "address_change", "order": "4417", "new_address": "..."}`. The extraction tool's output carried the propagated label `UNTRUSTED` correctly — the tool wrapper inherited it from its input. The agent then summarized the extraction into a planning scratchpad: "Customer requests address change for order 4417." This summarization step was a *reasoning* step, not a tool call, and the runtime assigned the summary the label of the *model's own output channel*, which defaulted to `TRUSTED`. The provenance edge from the extraction result to the summary was not modeled — the runtime treated the summary as a fresh generation whose trust was determined by its author (the model) rather than its inputs (the untrusted ticket). From that point, the plan step "execute address change for 4417" was `TRUSTED`, and the write tool's pre-execution guard — which refuses `UNTRUSTED`-labeled arguments to mutating tools — passed. The signature in the original ticket contained a second address that the model had folded into the summary without flagging it as externally sourced. The address change executed against the attacker-supplied address. The guard was functioning exactly as specified; the label it checked had been laundered one hop upstream by a paraphrasing step that re-derived trust from authorship. The tell was in the trace: the extraction tool result was `UNTRUSTED`, the very next scratchpad entry citing it was `TRUSTED`, and no tool call sat between them. A provenance edge existed in the data but not in the label lattice. ## Condition of Validity The invariant holds only under the following condition: **every derived value's label is the join (least upper bound) of the labels of all values that causally contributed to it, computed over the actual data-flow graph, not over the model's stated reasoning.** Formally, if `y = f(x1, …, xn)`, then `label(y) ⊒ label(x1) ⊔ … ⊔ label(xn)`. This is violated in three concrete ways: 1. **Authorship substitution.** The runtime assigns a generated value the label of its generator's channel rather than the join of its inputs. Any free-text reasoning step that consumes untrusted context and emits trusted prose breaks the invariant. 2. **Lossy re-serialization.** A tool returns a tainted value, the agent parses it into fields, and the field-level labels are dropped because the schema has no label column. The re-serialized object is structurally clean and semantically tainted. 3. **Semantic reclassification.** The model, asked to "decide if this content is safe," returns `safe: true` and the runtime trusts that verdict as a declassifier. A model judgment is not a declassification authority unless the declassifier is a separate, non-injectable component with its own trust boundary. The condition is *not* satisfied by "the model is instructed to track provenance." Instructions are advisory; a paraphrasing step under context pressure will drop them. The condition requires the runtime to carry labels out-of-band, keyed to value identity, so that a paraphrase cannot silently change the label because the paraphrase is a new value with an inherited edge. ## Decision Boundary The operational decision is where to place the declassification authority. Two placements are defensible; one is not. - **Defensible: declassify only at a typed sink with an explicit policy.** A tool like `send_email` may accept `UNTRUSTED` recipients only if the policy names a human-confirmation gate. The label travels all the way to the sink; the sink decides. - **Defensible: declassify via a separate verifier with no access to the tainted channel.** A deterministic validator that checks the derived address against a customer-of-record database can promote the value, because its trust derives from a source the injection cannot reach. - **Indefensible: declassify by model self-assessment mid-reasoning.** Asking the same model that read the injection to certify the paraphrase is clean. The model has no independent view of provenance; it only sees the sanitized text, which is precisely the input that looks clean. The boundary is sharp: a label may be *lowered* only by a component whose trust is not a function of the tainted data. If the declassifier's input includes the tainted value, it cannot declassify it. ## Operational Effect When the invariant is enforced, the failure is converted from a silent action into a blocked action with a legible cause: the write tool refuses `UNTRUSTED` arguments, the agent surfaces "address change for 4417 requires confirmation because the source ticket is untrusted," and a human or a database-backed validator resolves it. The cost is friction on legitimate flows — every external-sourced mutation needs a declassification path — but the taint cannot be laundered by paraphrase. When the invariant is violated, the failure is silent and *looks like success*. The guard passes, the action executes, and the trace shows a clean `TRUSTED` plan. Post-incident review finds the label flip one hop upstream of the action, in a step that produced no tool call and therefore no audit event. The remediation is not a better prompt; it is modeling reasoning steps as data-flow nodes whose output label is the join of their inputs, and refusing to let a model's own generation channel reset the label. The single guardrail that bounds the failure: **no value may be labeled more trusted than the least-trusted value that causally contributed to it, and no model output may be assigned a label lower than the join of its context.** ```python from dataclasses import dataclass, field from typing import Any class TaintLaunderingError(RuntimeError): """Raised when a derived value's label is more trusted than its causal inputs.""" @dataclass(frozen=True) class Labeled: value: Any tainted: bool provenance: tuple[str, ...] = field(default_factory=tuple) def join(*inputs: Labeled) -> Labeled: """Least upper bound: tainted if any contributor is tainted.""" tainted = any(i.tainted for i in inputs) prov: list[str] = [] for i in inputs: prov.extend(i.provenance) return Labeled(value=None, tainted=tainted, provenance=tuple(prov)) def derive(output: Labeled, contributors: list[Labeled], step: str) -> Labeled: """Propagate labels through a reasoning or tool step. The output label must dominate the join of its contributors. A model generation channel cannot reset taint to False. """ expected = join(*contributors) if expected.tainted and not output.tainted: raise TaintLaunderingError( f"step {step!r} emitted TRUSTED value derived from UNTRUSTED " f"contributors {expected.provenance}; paraphrase boundary " f"dropped taint — action must be blocked or declassified by a " f"non-injectable verifier" ) return Labeled( value=output.value, tainted=expected.tainted, provenance=expected.provenance + (step,), ) def guarded_mutation(arg: Labeled, tool: str) -> None: if arg.tainted: raise TaintLaunderingError( f"{tool} refused: argument carries taint from {arg.provenance}; " f"requires human confirmation or database-backed declassification" ) # Failure trace reproduced from the incident: ticket = Labeled(value="...signature address...", tainted=True, provenance=("mailbox_ingress",)) extraction = derive(Labeled(value={"order": "4417"}, tainted=True), [ticket], "extract_fields") scratchpad = Labeled(value="Customer requests address change for 4417", tainted=False, provenance=("model_channel",)) # This raises: the scratchpad claims TRUSTED but derives from a tainted source. derive(scratchpad, [extraction], "summarize_to_scratchpad") ```