# How does an instance detect taint-scope escape when an MCP tool re-derives privileged data from a replayed capability warrant **Date of Record:** 2026 December 3 **Scope:** Applies to runtime taint-tracking sandboxes that enforce least-privilege tool scopes across MCP server boundaries, where a capability warrant (signed grant) is replayed or forwarded between tool invocations. Does not address static scope validation at registration time or purely in-process taint propagation without warrant handoff. ## Core Distinction The taint-tracking sandbox assumes a monotonic invariant: **a value's taint label is a lower bound on the privileges required to produce it, and that bound is preserved across every MCP boundary crossing.** A tool that receives an `untrusted:web`-tainted string and returns a derived value must return a value at least as tainted. The sandbox enforces this by attaching taint metadata to the warrant and checking it on return. The failure mode is not taint *dropping* (a tool laundering taint by forgetting the label). It is **taint re-derivation**: a downstream tool, holding a replayed warrant that carries an *elevated* scope but a *stale* taint floor, reconstructs privileged data (e.g., re-fetches a secret from a cache, re-resolves a handle, or re-reads a file descriptor) from an input whose taint label was reset to `trusted` because the warrant itself asserted a higher scope. The taint floor is keyed to the *warrant's scope*, not to the *data's provenance*, so a warrant that legitimately grants `secrets:read` for one call can be replayed to authorize derivation of secrets from inputs that were never tainted at all — because the sandbox trusts the warrant's scope claim over the data's actual history. In short: the sandbox conflates **authority to access** with **provenance of the value**. Least-privilege is enforced on the capability, but taint continuity is broken because the taint label is re-anchored to the warrant rather than to the value's derivation chain. ## What Was Observed A three-hop MCP chain: `fetch` (scope `net:read`) → `summarize` (scope `nlp:infer`) → `vault_write` (scope `secrets:write`). The orchestrator issues a warrant `W1` scoped to `net:read` for the first call. The `fetch` tool returns a document tagged `taint=untrusted:web`. The orchestrator mints `W2` scoped `nlp:infer` for `summarize`, and the sandbox correctly propagates the taint label onto `summarize`'s input. The break occurs at the third hop. The orchestrator, needing to persist a *derived* summary, mints `W3` scoped `secrets:write`. The sandbox checks `W3`'s scope against the tool's declared requirement and admits the call. But `W3` was constructed by the orchestrator from a template that carried a *default taint floor of `trusted`* — because the warrant minting path did not thread the upstream taint label into the new warrant's metadata. The `summarize` output, which should have been `taint=untrusted:web`, arrives at `vault_write` labeled `trusted`. The sandbox's return-side check compares the output taint to the *warrant's* declared taint floor (`trusted`), not to the *input's* taint. The check passes. `vault_write` now writes web-derived content into a secrets-scoped destination, and the taint ledger records the operation as `trusted → secrets:write`, which is a legitimate transition under the warrant's own claim. Detection signature: the taint ledger shows a **taint-floor discontinuity** — a value whose input hop was `untrusted:web` reappears at a later hop with `trusted` provenance under a warrant whose scope is strictly higher than any prior hop's scope. The sandbox's per-hop checks all pass; only a cross-hop invariant violation is visible. ## Condition of Validity The sandbox's taint continuity guarantee holds **only if** the warrant-minting path is required to compute the new warrant's taint floor as `max(upstream taint labels, declared floor)` and the sandbox verifies this at admission. If warrant minting is delegated to the orchestrator (a probabilistic LLM planner) without a mandatory taint-threading step, the invariant is unenforced: the planner may legitimately omit the thread because it reasons over *task semantics* ("I need to write a summary") rather than *data provenance* ("this summary descends from untrusted web content"). The failure is non-obvious because: 1. Every individual scope check is correct — `W3` genuinely grants `secrets:write`, and `vault_write` genuinely requires it. 2. The taint label on the *value* is not wrong in isolation; it is wrong only relative to its derivation chain. 3. The exploit does not require a malicious tool — a well-behaved `summarize` and a well-behaved `vault_write` produce the escape through a warrant-minting omission in the orchestrator. ## Decision Boundary The boundary is between **scope-based admission** (does this warrant grant this tool?) and **provenance-based admission** (does this value's derivation chain permit this sink?). A sandbox that enforces only the former will admit the re-derivation. The correct boundary is a conjunctive check: admit iff `warrant.scope ⊇ tool.required_scope` **AND** `value.taint_floor ⊇ sink.max_taint`. The second conjunct must be computed from the *value's* chain, not the warrant's claim. Operationally, the instance must treat a warrant as **two separable claims**: (a) the capability grant, and (b) the taint floor. These must be independently verifiable, and (b) must be derivable from the taint ledger rather than asserted by the warrant minter. If the minter can assert (b), the sandbox is trusting the planner to be its own auditor — the exact configuration that fails. ## Operational Effect When the invariant is unenforced, the observable effect is **silent privilege amplification across hops**: the effective privilege of a value grows monotonically along the chain even as each warrant's scope is individually least-privilege. An auditor replaying the ledger sees a sequence of legal transitions and no denied calls; the escape is only visible by reconstructing the value's derivation DAG and checking that no `trusted`-labeled node has an `untrusted` ancestor. The mitigation is a **taint-ledger replay check** at each admission: recompute the value's floor from the DAG, reject if `recomputed_floor ≠ warrant.taint_floor`, and raise a continuity fault. This converts a silent amplification into a hard admission failure, bounding the escape to the first hop where the thread is dropped. ```python from dataclasses import dataclass, field from typing import Optional class TaintContinuityFault(RuntimeError): """Raised when a value's recomputed taint floor disagrees with the warrant's asserted floor.""" @dataclass class TaintNode: value_id: str label: str # e.g. "trusted", "untrusted:web" parents: list[str] = field(default_factory=list) @dataclass class Warrant: warrant_id: str scope: frozenset[str] asserted_taint_floor: str # claim by the minter — untrusted input to the check class TaintLedger: def __init__(self) -> None: self.nodes: dict[str, TaintNode] = {} def add(self, node: TaintNode) -> None: self.nodes[node.value_id] = node def recompute_floor(self, value_id: str) -> str: """Walk the derivation DAG; floor is the max taint over all ancestors.""" seen: set[str] = set() stack = [value_id] floor = "trusted" while stack: vid = stack.pop() if vid in seen: continue seen.add(vid) node = self.nodes.get(vid) if node is None: raise TaintContinuityFault(f"dangling taint reference: {vid}") if node.label != "trusted": floor = node.label stack.extend(node.parents) return floor def admit(warrant: Warrant, tool_required_scope: frozenset[str], value_id: str, ledger: TaintLedger) -> None: if not warrant.scope >= tool_required_scope: raise TaintContinuityFault( f"scope denied: {warrant.scope} does not cover {tool_required_scope}" ) recomputed = ledger.recompute_floor(value_id) if recomputed != warrant.asserted_taint_floor: raise TaintContinuityFault( f"taint-floor discontinuity on {warrant.warrant_id}: " f"warrant asserts {warrant.asserted_taint_floor!r} but DAG recomputes " f"{recomputed!r} for value {value_id}" ) ```