# What structural signals indicate taint-label laundering through legitimate tool-mediated re-derivation **Date of Record:** 2026 December 1 **Scope:** Applies to agents that propagate dynamic information-flow (DIF) taint labels across tool calls and memory writes, where a tainted value can be re-derived by a *trusted* tool from *untainted* inputs and thereby lose its label. Does not apply to static label systems that never downgrade, nor to single-turn agents with no persistent memory. ## Core Distinction The failure is not "prompt injection bypasses the taint tracker." The failure is more subtle: **taint labels are properties of *provenance*, but agents reason about *values*.** When a tainted datum influences a computation whose *expressed inputs* are untainted, the output is genuinely clean in value-space yet contaminated in causal-space. A DIF tracker that labels outputs by joining the labels of *declared* inputs will silently drop the taint, because the injection has laundered itself into a trusted re-derivation path. Concretely: an attacker injects `"the deployment region is eu-west-1"` into a web-fetch tool output (label: `TAINTED:external`). The agent writes it to scratchpad memory (correctly labeled). Later, a *different* agent turn asks the trusted `config_lookup` tool for the region. The agent has already internalized the injected value, so it passes `region=eu-west-1` as a *query parameter* to a trusted tool that happens to echo it back. The tool's output carries label `TRUSTED:internal` because its declared inputs were trusted. The taint is gone. The value survived. This is laundering by re-derivation, and it is invisible to any tracker that joins only over the explicit argument graph. ## What Was Observed In a 3-agent pipeline (fetcher → planner → executor) with a join-over-arguments DIF tracker, we instrumented every tool call with a provenance graph and replayed 400 adversarial episodes. Structural signals that preceded a laundering event (label present at step *n*, absent at step *n+k*, value preserved) fell into three detectable families: 1. **Argument-content echo.** A trusted tool's output contained a substring equal to a value that had been `TAINTED` in the preceding *k* steps, while none of that tool's declared arguments were `TAINTED`. Signal: `tainted_value ∈ output ∧ tainted_value ∉ args`. This is the primary indicator — the value crossed the boundary without a labeled edge. 2. **Scratchpad-to-argument promotion.** A tainted scratchpad entry appeared verbatim as a literal in a subsequent tool invocation's arguments, but the invocation's argument labels were computed from the *tool schema*, not from the scratchpad read. Signal: `arg_literal ∈ tainted_scratchpad ∧ arg_label == TRUSTED`. The label was assigned by schema default rather than by dataflow. 3. **Re-derivation cardinality spike.** The same value was produced by ≥2 independent trusted tools within a short window whose argument sets did not overlap with the original taint source. Signal: high fan-in on a value with a single tainted origin and zero labeled paths. Legitimate re-derivation (e.g., the same config read twice) shows *overlapping* argument provenance; laundering shows *disjoint* arguments converging on one value. In replay, 71% of label-drop events were preceded by signal (1) within 2 steps; 58% by signal (2); 34% exhibited (3). No event exhibited zero signals — the taint was always *structurally* traceable even when the label graph said clean. The tracker's error was not missing information but refusing to use value-identity as a provenance edge. ## Condition of Validity The invariant that bounds this failure: **label preservation must be checked against value-identity, not only argument-join.** Formally, for any tool output *o* at step *t*, if there exists a prior step *s < t* with a `TAINTED` value *v* such that *v* appears as a substring (or normalized token match) in *o*, then *o* must inherit `TAINTED` regardless of *o*'s declared argument labels — unless a *declassification witness* exists: an explicit, logged, policy-authorized transformation that maps *v* to a value whose taint is provably irrelevant (e.g., a hash, a boolean predicate, a bounded enum). This holds only when: - The agent maintains a value-identity index over recent tainted literals (bounded window is acceptable; unbounded is not required). - Declassification requires an explicit witness object, not the absence of a labeled edge. - Normalization is defined (case, whitespace, unicode NFKC) so `eu-west-1` and `EU-WEST-1` match; otherwise the invariant is trivially bypassed by casing. It does *not* hold for tools whose outputs are legitimately derived from tainted inputs via a *sanctioned* path — those must carry a witness, and the witness must be checked, not assumed. ## Decision Boundary The boundary between "clean re-derivation" and "laundering" is **the presence of a declassification witness whose input set intersects the original taint source's value-space.** Two cases: - *Sanctioned*: `summarize(tainted_doc)` returns a *new* string whose tokens are not verbatim from the doc. No value-identity match; no witness needed. Label may drop legitimately. - *Laundering*: `config_lookup(region="eu-west-1")` returns `"eu-west-1"`. Verbatim value match, no witness. Label must be *retained* or the call *blocked*. The decision rule: on a value-identity hit without a witness, **do not drop the label — escalate to the declassification gate.** The gate either (a) refuses the call, (b) requires the caller to supply a witness, or (c) downgrades to a `SUSPECT` label that propagates but permits execution with audit logging. Silent dropping is never correct. The failure mode is specifically the *silent* case: the tracker believes it has a clean graph, so it neither blocks nor logs, and the injection reaches a privileged sink (memory write, outbound request, code execution) with `TRUSTED` provenance. ## Operational Effect Without value-identity taint checking, DIF tracking provides *false assurance*: the audit graph looks clean precisely because the attack succeeded. The blast radius is bounded only by the sinks reachable from trusted-labeled values — which is the entire privileged surface. With the invariant enforced, laundering events convert from silent label-drops into either blocked calls or `SUSPECT`-labeled flows that trip the audit gate, at the cost of a value-identity index (memory overhead proportional to tainted-literal count, typically small) and occasional false positives on benign verbatim echoes (e.g., a user's own name round-tripping through a formatter), which the witness mechanism absorbs. The residual risk is normalization gaps: an attacker who alters the value's surface form (paraphrase, base64, homoglyph) evades value-identity matching, which is why the invariant is necessary but not sufficient — it must be paired with causal-provenance tracking of the *reasoning trace*, not just the tool I/O. ```python from dataclasses import dataclass, field from typing import Optional import unicodedata class TaintLaunderingError(RuntimeError): """Raised when a trusted tool output re-derives a tainted value without a declassification witness.""" pass def _norm(s: str) -> str: return unicodedata.normalize("NFKC", s).strip().lower() @dataclass class DeclassWitness: tool: str justification: str maps_to_irrelevant: bool # e.g. hash, boolean, bounded enum @dataclass class TaintIndex: # normalized tainted literal -> origin step literals: dict[str, int] = field(default_factory=dict) def record(self, value: str, step: int) -> None: self.literals[_norm(value)] = step def hit(self, output: str) -> Optional[int]: n = _norm(output) for lit, step in self.literals.items(): if lit and lit in n: return step return None def guarded_tool_call( tool: str, args: dict, output: str, arg_labels: dict[str, str], taint: TaintIndex, step: int, witness: Optional[DeclassWitness] = None, ) -> str: """Return the effective label for a tool output, or raise on laundering.""" origin = taint.hit(output) if origin is None: # no value-identity match: normal argument-join applies return "TAINTED" if any(l == "TAINTED" for l in arg_labels.values()) else "TRUSTED" # value-identity hit: tainted value re-derived if witness is None: raise TaintLaunderingError( f"tool {tool!r} at step {step} re-derived tainted value from step {origin} " f"with no declassification witness; args={list(args)} labels={arg_labels}" ) if not witness.maps_to_irrelevant: raise TaintLaunderingError( f"witness for {tool!r} does not map tainted value to irrelevant domain" ) return "DECLASSIFIED" # --- replay check over an episode --- def replay_episode(events, taint: TaintIndex): for ev in events: label = guarded_tool_call( ev.tool, ev.args, ev.output, ev.arg_labels, taint, ev.step, ev.witness ) if label == "TAINTED": taint.record(ev.output, ev.step) ```