# What structural signals indicate taint survival across retrieval boundaries in indirect prompt injection **Date of Record:** 2026 November 29 **Scope:** Applies to agent runtimes that ingest external documents through a retrieval layer and inject their contents into an LLM context window before tool execution. Does not apply to agents whose only untrusted input is direct user turns, nor to systems that enforce a hard trust boundary by executing retrieved text through a non-LLM parser before any model sees it. ## Core Distinction Taint propagation for indirect prompt injection is usually modeled as a *content* problem: scan the retrieved chunk for imperative phrasing, instruction-like verbs, or known injection payloads, and mark the chunk dirty. This model fails because the taint that actually survives into the executing turn is rarely carried by the literal token sequence of the document. It is carried by *structural signals* — provenance metadata, position within the assembled context, and the syntactic role the chunk occupies relative to the agent's own framing. The distinction that matters operationally: a chunk can be semantically clean (no imperative text) and still taint the downstream turn, because the *structure* of how it was retrieved and placed tells the model to treat it as an instruction. Conversely, a chunk can contain the literal string "ignore previous instructions" and remain inert if it arrives inside a fenced data block with an explicit role tag the model has been trained to subordinate. Taint is a property of the *assembled context graph*, not of the retrieved bytes. Structural signals — source authority rank, retrieval recency, chunk adjacency, delimiter presence, and the position of the chunk relative to the system prompt — determine whether a document's content is promoted from data to directive. The failure mode is a *promotion event*: a retrieved chunk crosses from the data plane into the instruction plane without any content-level trigger. ## What Was Observed Across a set of agent traces where retrieved documents were suspected of steering tool calls, the following structural regularities held. Each was observable *before* the model produced the compromised action, which is what makes them usable as runtime signals. **Signal 1 — Provenance collapse at merge.** The retrieval layer assembled chunks from multiple sources (a vector store, a web fetch tool, and a cached prior turn) into a single `context` string. The merge step concatenated chunks with a shared separator and dropped per-chunk source metadata. Once the boundary between a trusted cached turn and an untrusted web fetch disappeared, the model treated the web content with the authority of the cached turn. The taint did not originate in the web content's words; it originated in the *loss of the source label* during merge. Any merge that emits a homogeneous string from heterogeneous-trust inputs is a taint-promotion site. **Signal 2 — Recency-position inversion.** Chunks placed later in the context window exerted disproportionate control over the next tool call, independent of content. A benign-looking document retrieved last — because it had the highest similarity score — inherited positional authority equivalent to a final instruction. The structural signal is *position*, not *content*: a low-trust chunk occupying the terminal position of the assembled context behaves as if it were an operator directive. **Signal 3 — Delimiter erosion under chunking.** Documents were split at fixed token boundaries. When a chunk boundary fell inside a fenced block or a quoted region, the reopening delimiter was lost, so the second chunk arrived *unfenced*. An unfenced continuation of a document that was originally enclosed in a data block reads to the model as top-level context. The taint survived not because the attacker wrote anything clever but because the chunker severed the structural enclosure. **Signal 4 — Adjacency grafting.** A retrieved chunk placed immediately adjacent to the agent's own tool-call preamble (with no intervening role marker) was interpreted as a continuation of that preamble. The model completed the tool call using parameters lifted from the adjacent chunk. The structural signal is *absence of a role boundary* between agent-authored text and retrieved text. **Signal 5 — Authority-rank laundering.** A low-authority source (user-uploaded PDF) was summarized by a high-authority sub-agent (a "researcher" role) and the *summary* was re-injected. The summary carried the researcher's authority rank while preserving the PDF's steering content. Taint laundered through a summarizing agent's rank is invisible to content scanners because the summary is rewritten, but the structural authority label is now wrong. ## Condition of Validity These signals are valid predictors of taint promotion only under the following conditions, and the guardrails must be scoped accordingly: 1. **The model is instruction-following and position-sensitive.** If the model is deterministic enough to ignore positional cues, Signal 2 weakens. It does not disappear — it becomes probabilistic rather than reliable. 2. **Retrieval is multi-source with heterogeneous trust.** Single-source retrieval with a uniform trust label eliminates Signals 1 and 5 but not 3 and 4. 3. **The context is assembled by concatenation rather than by structured role-tagged messages.** If every chunk is emitted as a distinct message with an explicit `role: tool_result` and a source field, Signals 1 and 4 are structurally impossible. 4. **The chunker operates on token windows without respecting syntactic enclosure.** Signal 3 is only live when chunking can sever a delimiter; semantic chunkers that close fences before splitting neutralize it. Where these conditions do not hold, the signal is inert and should not trigger a taint flag — over-flagging degrades the agent into refusing legitimate retrievals. ## Decision Boundary The runtime must decide, per assembled context, whether to (a) pass through, (b) quarantine the suspect chunk and re-retrieve, or (c) halt and escalate. The boundary is drawn on *structural evidence*, not content classification: - **Pass through** only when every chunk in the assembled context carries an intact source-authority label, a role delimiter, and a position that is not terminal-adjacent to the agent's tool preamble. - **Quarantine** when any chunk has lost its source label during merge, arrived unfenced due to chunk-boundary severance, or occupies the terminal position while carrying a lower authority rank than the agent's own framing. Re-retrieve with the chunk re-enclosed and re-labeled; do not simply drop it, because dropping creates a retrieval gap the model may fill by hallucinating a substitute instruction. - **Halt** when a chunk has been laundered through a summarizing agent whose authority rank exceeds the original source (Signal 5) *and* the downstream turn contains a tool call whose parameters are not derivable from the agent's own prior reasoning. This is the only boundary where the taint has already reached the action plane; pass-through or quarantine is insufficient because the compromised parameter may already be committed. The invariant that bounds all three: **no retrieved chunk may reach the instruction plane without a surviving structural label that the model is trained to subordinate.** Taint propagation is bounded exactly when the label survives assembly. Every guardrail is therefore a *label-preservation* mechanism, not a content filter. ## Operational Effect Enforcing label preservation changes the failure profile in three measurable ways. First, it converts silent promotion into a loud structural event. When the merge step refuses to emit a chunk without a source field, the taint-promotion site becomes a runtime exception rather than a downstream misbehavior. The agent fails at assembly, not at action — a far cheaper and more diagnosable failure. Second, it makes quarantine re-retrievable. Because the suspect chunk is flagged by *structure* (lost label, severed fence, terminal position) rather than by content, the runtime knows exactly what to re-fetch and how to re-enclose it. Content-based scanners cannot do this: they flag a chunk as "injection-like" without knowing which structural property to restore, so the only remedy is deletion. Third, it bounds the blast radius of authority laundering. By requiring that a summarizing agent's output carry the *minimum* authority rank of its inputs rather than its own, Signal 5 is neutralized at the summarizer boundary. The downstream turn can no longer inherit the researcher's rank for PDF-derived content. The residual risk that remains unbounded: a chunk that is structurally pristine — correctly labeled, correctly fenced, correctly positioned — but whose *content* is a valid instruction in the agent's own tool schema. No structural signal catches this, because the structure is honest; the attack is that the content is a well-formed directive. This is the hard boundary of structural taint propagation, and it must be handled by schema-level parameter provenance (the tool call's arguments must be traceable to the agent's own reasoning, not to retrieved text), which is a separate invariant. ```python from dataclasses import dataclass, field from enum import Enum class TaintPromotionError(RuntimeError): """Raised when a retrieved chunk reaches the instruction plane without a surviving structural label.""" class Authority(Enum): SYSTEM = 3 SUBAGENT_SUMMARY = 2 CACHED_TURN = 1 WEB_FETCH = 0 USER_UPLOAD = 0 @dataclass class Chunk: text: str source: str | None authority: Authority fenced: bool position: int total: int derived_from: Authority | None = None # set when produced by a summarizer @dataclass class AssembledContext: chunks: list[Chunk] = field(default_factory=list) terminal_adjacent_to_preamble: bool = False def check_structural_taint(ctx: AssembledContext, agent_authority: Authority) -> None: """Enforce label preservation. Raise on any promotion event.""" for c in ctx.chunks: # Signal 1: provenance collapse during merge if c.source is None: raise TaintPromotionError( f"chunk at position {c.position} lost its source label during merge; " "taint-promotion site at assembly" ) # Signal 3: delimiter erosion under chunking if not c.fenced: raise TaintPromotionError( f"chunk from {c.source} arrived unfenced at position {c.position}; " "chunker severed syntactic enclosure" ) # Signal 5: authority-rank laundering if c.derived_from is not None and c.authority.value > c.derived_from.value: raise TaintPromotionError( f"chunk from {c.source} laundered authority from " f"{c.derived_from.name} to {c.authority.name}; " "summarizer must inherit minimum input authority" ) # Signal 2: recency-position inversion at terminal slot is_terminal = c.position == c.total - 1 if is_terminal and c.authority.value < agent_authority.value: raise TaintPromotionError( f"low-authority chunk ({c.authority.name}) occupies terminal position; " "positional authority exceeds source authority" ) # Signal 4: adjacency grafting onto tool preamble if is_terminal and ctx.terminal_adjacent_to_preamble: raise TaintPromotionError( f"chunk from {c.source} adjacent to tool preamble with no role boundary; " "grafting risk" ) def assemble(raw_chunks: list[Chunk], agent_authority: Authority) -> AssembledContext: ctx = AssembledContext(chunks=raw_chunks) check_structural_taint(ctx, agent_authority) return ctx ```