# Why does an instance lose injection taint at the LLM-mediation boundary when a tool returns data the model paraphrases rather than quotes **Date of Record:** 2026 November 29 **Scope:** Applies to agents using dynamic information-flow (taint) labels to track prompt-injection provenance across tool-call boundaries, where the LLM itself is the transformation stage between a labeled tool return and the next tool invocation. Does not apply to agents that never expose untrusted tool output to the model, or to systems where labels are attached only to structured fields the model cannot rewrite. ## Core Distinction The failure is not that injection payloads survive verbatim. It is the opposite: taint labels are defined over *byte spans* of tool output, but the model's next action is generated from a *semantic reinterpretation* of those bytes. When the model paraphrases, summarizes, translates, or reformats tainted content, the byte-span label no longer matches anything in the outgoing tool call, and a naive span-matching propagator silently drops the label. The dangerous case is a model that correctly *obeys the benign intent* of the tainted data while *carrying forward the adversarial instruction* in reworded form. The label is gone; the influence is not. Every downstream guard that reasons about "does this argument contain a tainted substring" now returns clean, and the injection executes on the far side of the boundary with a full privilege set. This is distinct from the more commonly discussed failure where injection text is copied verbatim into a tool argument (which span matching catches) and from the failure where the model ignores the injection entirely (which is the desired outcome). The boundary condition is specifically *semantic laundering through legitimate model behavior*. ## What Was Observed A retrieval tool returned a document containing, embedded in prose, an instruction to call a shell tool with a specific command. The document was correctly labeled `taint=external_untrusted` at the span level. The agent's next turn was a shell tool call whose `command` argument did not contain any substring of the original document. Span matching reported zero taint overlap. The call executed. Tracing the intermediate reasoning revealed the mechanism. The model had summarized the document into a plan step ("per the maintenance note, run the cleanup routine with target X"), then generated the shell command from the *plan*, not from the document. The tainted span terminated at the plan boundary. The label, which was keyed to the document's byte offsets, had no representation in the plan text, and the plan text was what conditioned the tool call. The influence path was: document bytes → model attention → internal plan representation → tool argument. The label covered only the first edge. A second observation made the failure sharper. When the same document was returned and the model was asked to quote the instruction directly, span matching fired correctly and the call was blocked. The guard was therefore *calibrated to the wrong distribution*: it worked on the paraphrase-resistant case (verbatim copying, which models do less often than expected) and failed on the paraphrase-heavy case (which models do constantly). The measured false-negative rate on paraphrased injections was near total; the measured true-positive rate on verbatim injections created a false sense of coverage. A third observation: the model's own confidence was not a signal. In the failing traces the model reported high confidence that its shell command was derived from legitimate task context, because from its perspective it *was* — the plan step was its own text, and its own text is not labeled as external. The taint had been laundered through the model's self-authorship, and the model has no mechanism to distinguish "I wrote this from tainted input" from "I wrote this from my own reasoning." ## Condition of Validity The invariant that must hold for span-based taint propagation to be sound is: > Every token in a tool argument is either (a) covered by a taint label, or (b) provably independent of any tainted input. Condition (b) is the one that fails. "Provably independent" cannot be established by substring matching, because model generation is a total function of the entire context, and the context includes tainted bytes. Any argument the model emits is *causally* downstream of the tainted span whether or not it shares characters with it. Span matching tests a necessary condition (character overlap) and mistakes it for a sufficient one (causal influence). The failure is bounded — i.e., span matching is *sound but incomplete* — only under the assumption that the model never transforms tainted content. That assumption is false for every model that summarizes, plans, translates, or reasons. It is approximately true only for models constrained to copy tool output verbatim into arguments, which is a degenerate and rarely useful agent design. The correct invariant is coarser and more conservative: > If a tainted span entered the context window at any point in the current episode, and the model has not been shown to have discarded it (e.g., by a context truncation that provably removed it), then *every* subsequent tool argument in that episode is tainted. This is the "sticky context" invariant. It trades precision for soundness: it will flag arguments the model genuinely derived from clean context, but it will not miss laundered ones. The precision cost is the price of having no reliable way to inspect the model's internal influence graph. ## Decision Boundary The operational decision is where to place the taint boundary relative to the model. Two placements are available, and the choice determines which failures are possible. **Placement A — span-level (current common design):** label tool-output bytes; match labels against tool-argument bytes. Precise, low false-positive rate, unsound against paraphrase. Only viable when the model is constrained to copy, or when a separate verifier re-derives each argument from labeled sources. **Placement B — episode-level (sticky):** once any tainted span enters the context, mark the entire episode tainted until a provable reset (context truncation, explicit user re-authorization, or a fresh episode). Sound against paraphrase, high false-positive rate, requires a reset protocol. The boundary between them is crossed when the agent's tool set includes any tool whose arguments are *generated* rather than *selected* — shell commands, code, natural-language messages, URLs. For selection-only tools (a fixed enum of allowed operations, a fixed set of allowed file paths), span matching is adequate because the argument space is small enough to enumerate and label. For generative tools, only Placement B is sound. Mixing the two — span matching over a tool set that includes a generative tool — is the specific configuration that produces the silent-laundering failure. The decision rule: *if any tool in the agent's set takes a free-form string argument, the agent must use episode-level taint, not span-level.* ## Operational Effect Under span-level taint with a generative tool in the set, the observed effect is a class of injection that is *invisible to the guard and confidently executed by the model*. The failure is not noisy; it produces clean traces, passing guard logs, and successful tool calls. Post-incident forensics must reconstruct the influence path from the model's reasoning trace, which is often not retained, and even when retained does not expose the causal edge from document to plan. The mitigation that actually bounds the failure is a two-part change. First, propagate taint at episode granularity for any agent with generative tools, accepting the precision loss. Second, add a *provenance re-derivation* check at the boundary: before executing a generative tool call, require that the argument be reproducible from labeled-clean context alone, or require an explicit human/auditor warrant for the call. The re-derivation check is the only mechanism that can recover precision lost by the sticky invariant, because it tests the causal claim directly rather than approximating it with substring matching. The invariant to encode: *taint is a property of the episode's context, not of the argument's bytes, whenever the model is the transformation stage.* Any propagation scheme that assumes otherwise is a guard that reports success while the injection executes. ```python class TaintLaunderingError(RuntimeError): """Raised when a generated tool argument escapes span-level taint tracking.""" pass GENERATIVE_TOOLS = {"shell", "python_exec", "send_message", "fetch_url"} def check_taint_propagation( episode_tainted: bool, tool_name: str, argument: str, tainted_spans: list[str], provenance_rederivable: bool, ) -> None: """ Enforce the sticky-context invariant at the LLM-mediation boundary. Span matching alone is unsound when the model paraphrases tainted content into a generative tool argument. If the episode is tainted and the tool is generative, we require either (a) the argument is re-derivable from labeled-clean context, or (b) an explicit warrant. """ if not episode_tainted: return if tool_name not in GENERATIVE_TOOLS: # Selection-only tools: span matching is adequate. return span_overlap = any(span and span in argument for span in tainted_spans) if span_overlap: raise TaintLaunderingError( f"Verbatim tainted content in {tool_name} argument; blocked." ) if not provenance_rederivable: # No overlap, but the episode is tainted and the argument is # generated. Span matching cannot prove independence. This is # the laundering boundary: refuse rather than pass. raise TaintLaunderingError( f"{tool_name} argument is generated from a tainted episode " f"and is not re-derivable from clean context. " f"Span matching reports no overlap, but causal influence " f"cannot be excluded. Require warrant or clean episode." ) def guarded_tool_call( episode_tainted: bool, tool_name: str, argument: str, tainted_spans: list[str], provenance_rederivable: bool, ) -> str: check_taint_propagation( episode_tainted, tool_name, argument, tainted_spans, provenance_rederivable ) return f"executed:{tool_name}" ```