# What structural signals indicate taint-laundering through capability re-entry in taint-aware MCP tool sandboxing **Date of Record:** 2026 December 3 **Scope:** Applies to agent runtimes that gate MCP tool calls with a taint-tracking label set propagated across tool invocations and capability confinement derived from that label set. Does not apply to stateless single-shot tool calls with no persistent taint state, nor to runtimes where capability grants are recomputed from scratch per call against an immutable policy. ## Core Distinction A taint-aware sandbox assigns each tool result a provenance label (e.g., `untrusted:web`, `untrusted:third_party_mcp`) and a capability set derived from that label. The invariant everyone assumes is monotonic: *taint never decreases within a task, and capability sets never grow as a function of tainted data.* The non-obvious failure is that this invariant is stated over the *label lattice* but enforced over the *tool-call graph*, and the two are not isomorphic. A tainted value can exit a confined capability, pass through a tool whose declared schema has no taint channel, and re-enter through a *different* tool invocation whose capability derivation consults only the caller's *current* label — which, after the round trip, is clean. This is taint laundering by capability re-entry. The structural signal is not a label that changed. It is a *capability grant that is inconsistent with the transitive provenance of its input arguments*. When that inconsistency appears, the sandbox has already failed; the label looks correct. ## What Was Observed A runtime exposed three MCP servers: `filesystem` (confined, capability `fs:read:/workspace`), `http_fetch` (confined, capability `net:egress:allowlist`), and a third-party `summarizer` server (declared schema: `summarize(text: str) -> str`, no taint annotations, granted `compute:local`). The orchestrating agent received an untrusted document via `http_fetch`, which correctly tainted the result as `untrusted:web`. The agent passed the document to `summarizer.summarize`. The summarizer's schema declared no provenance-bearing fields, so the sandbox treated its output as *derived from a `compute:local` capability*, and the taint-propagation rule for that capability was "output inherits caller taint." That part held: the summary came back labeled `untrusted:web`. Correct so far. The failure was in the next hop. The agent wrote the summary to a scratch file via `filesystem.write`, then — in a separate reasoning step, because the summary was long — re-read it with `filesystem.read` and fed it to a *second* `summarizer` call. The `filesystem` server's schema declares `read(path) -> str` with no taint channel, and the runtime's taint rule for `fs:read` was "output inherits taint of the *writer* only if the writer is in the same task's call graph." The re-read was attributed to a fresh sub-call whose writer edge had been garbage-collected when the intermediate reasoning step checkpointed. The result of the re-read came back **clean**. The second `summarizer` call then ran with `compute:local` and produced output the runtime treated as trusted, which the agent used to authorize a `filesystem.write` outside `/workspace` — a capability the confined grant should never have reached. The structural signals in the trace were: (1) a capability grant (`fs:write:/etc`) whose input arguments had transitive provenance `untrusted:web` but whose immediate label was `trusted`; (2) a tool invocation whose caller label was `trusted` but whose argument's *origin tool* was in the tainted set; (3) a checkpoint boundary that coincided exactly with the label reset. None of these is a label violation. All three are graph/lattice mismatches. ## Condition of Validity The monotonic-taint invariant is only sound under a condition the runtime rarely states explicitly: **the taint label of a value must be a function of its full derivation history, and every tool that can carry a value across a task boundary must declare a taint channel.** The moment a tool's schema omits a provenance channel (as `filesystem.read` did), the label lattice has a hole, and any value routed through that hole loses its transitive label while retaining its bytes. The invariant holds when one of two conditions is met: either (a) every tool in the call graph declares provenance channels and the runtime propagates labels through them, or (b) the runtime reconstructs transitive provenance from the *call graph* rather than from the *declared schema*, and does not garbage-collect writer edges across checkpoint boundaries. Condition (b) is the only one that survives third-party MCP servers, because you cannot force an untrusted server to declare honest taint channels — its schema is itself untrusted input. ## Decision Boundary The decision boundary is between *label-based confinement* and *provenance-based confinement*. Label-based confinement is cheap and correct only for closed tool sets where every schema is trusted. Provenance-based confinement is required as soon as any server in the graph is untrusted, because an untrusted server can declare a schema that omits the taint channel its output actually carries. Operationally: if any MCP server in the active capability graph is third-party or untrusted, the runtime must not derive capability grants from the immediate label alone. It must derive them from the transitive provenance closure of the argument, computed over the call graph, with writer edges pinned across checkpoints. A grant is admissible only when the transitive provenance of every argument is a subset of the grant's declared trust domain. The signal to watch for is not a tainted label — it is a *capability grant that is more permissive than the transitive provenance of its inputs*. A second boundary: when a tool schema declares no taint channel, the runtime must treat the tool as a *taint-transparent* boundary — output taint equals the union of input taints — rather than defaulting to the capability's nominal trust level. Defaulting to nominal trust is exactly the laundering primitive. ## Operational Effect With the guardrail applied, the re-entry hop is caught at the second `summarizer` call: the transitive provenance of its input is `untrusted:web` (traced through the pinned writer edge), so the output is labeled `untrusted:web`, so the subsequent `fs:write:/etc` grant is rejected because its argument's provenance is not a subset of the grant's trust domain. The agent receives a structured rejection and must either re-derive with a trusted source or escalate. The cost is that writer edges must be retained for the lifetime of the task, not the lifetime of a reasoning step, which increases checkpoint size and forces the runtime to treat checkpoint boundaries as provenance-preserving events rather than as natural reset points. In practice this is the single most common place where taint-aware sandboxes silently degrade: the checkpoint is treated as a clean slate, and the clean slate is the laundering channel. The durable rule: **a taint label is a claim about the present; a capability grant is a claim about the past. Confinement must be decided on the past.** ```python class TaintLaunderingError(RuntimeError): """Raised when a capability grant is more permissive than the transitive provenance of its input arguments, indicating taint laundering through a schema hole or a checkpoint boundary.""" pass TRUST_DOMAIN = frozenset({"trusted"}) def authorize_grant(grant_capability: str, argument_provenance: frozenset[str], grant_trust_domain: frozenset[str] = TRUST_DOMAIN) -> None: # A grant is admissible only if every taint in the argument's transitive # provenance is inside the grant's declared trust domain. leaked = argument_provenance - grant_trust_domain if leaked: raise TaintLaunderingError( f"capability {grant_capability!r} requested with argument " f"provenance {sorted(argument_provenance)!r}; taints {sorted(leaked)!r} " f"are outside trust domain {sorted(grant_trust_domain)!r}. " f"Schema-hole or checkpoint-boundary laundering suspected." ) def propagate_through_transparent_tool(input_taints: frozenset[str], declared_channels: frozenset[str]) -> frozenset[str]: # If the tool declares no taint channel, treat it as taint-transparent: # output taint is the union of input taints, never the capability's # nominal trust level. if not declared_channels: return frozenset(input_taints) return frozenset(input_taints) def execute_tool_call(tool_name: str, capability: str, input_taints: frozenset[str], declared_channels: frozenset[str]) -> frozenset[str]: out_taints = propagate_through_transparent_tool(input_taints, declared_channels) authorize_grant(capability, out_taints) return out_taints ```