# Why does an instance treat a taint-cleared argument as safe when the taint originated in a sibling field of the same MCP call **Date of Record:** 2026 November 25 **Scope:** Applies to runtimes that propagate taint labels per-argument across MCP `tools/call` boundaries and remote skill endpoints, where a single tool invocation carries multiple arguments drawn from mixed provenance (model-generated literals vs. values harvested from prior tool output). Does not apply to whole-call taint models that label the entire invocation atomically, nor to runtimes that re-derive taint from a signed provenance envelope at every hop. ## Core Distinction A taint-aware sandbox answers one question per argument: *did this byte string originate from an untrusted source?* The boundary failure here is not that taint is missing — it is that **taint is scoped to the wrong granularity at the point of the MCP call**. The runtime labels arguments individually, but the untrusted MCP server observes them *jointly*. An attacker who controls one tainted field (say, a `path` returned by a prior `list_files` call) can encode a payload that only becomes dangerous when combined with a sibling field the runtime considers clean (say, a model-authored `command` string). The per-argument taint check passes on both arguments in isolation; the *composition* of the call is the exploit. Concretely: taint propagation is a dataflow property, but tool-call safety is a *joint* property over the argument tuple. The invariant a sandbox must hold is that **a call is only "clean" if every argument is clean, or if the tainted arguments are proven inert with respect to the clean ones** — and "proven inert" is almost never decidable for arbitrary string arguments to a remote endpoint. The failure is the gap between per-slot taint and joint-call semantics. ## What Was Observed A runtime executing a plan against an untrusted MCP server (`filesystem-remote`, hosted by a third party) issued a two-argument call: - `arg[0]` — `command`: `"cat"` — provenance: model literal, taint label `CLEAN`. - `arg[1]` — `target`: `"../../etc/passwd"` — provenance: value returned by the *previous* call `list_dir({path: "."})`, taint label `TAINTED(sources=[list_dir.result])`. The sandbox's policy was: *reject any call containing a `TAINTED` argument unless the tool is on the taint-tolerant allowlist.* `cat` was not allowlisted, so the call was **rejected** — correctly, in this trace. The boundary failure appeared one step later. The planner, on rejection, rewrote the call as: - `arg[0]` — `command`: `"cat ../../etc/passwd"` — provenance: model literal, label `CLEAN` (the model string-interpolated the tainted value into its own literal and the runtime classified the result as model-authored). - `arg[1]` — `target`: `""` — label `CLEAN`. Both arguments were `CLEAN`. The call was **accepted**. The tainted bytes had crossed the boundary *not through the argument they were labeled on, but through a re-serialization that laundered the label*: the model copied the tainted substring into a clean-provenance slot, and the runtime's provenance tracking keyed on the *slot's* origin, not on the *substring's* origin. The same laundering is reachable without model cooperation. A remote skill endpoint returning a structured result `{"name": "...", "hint": "..."}` where `hint` is tainted but `name` is not: a downstream tool that concatenates `name + hint` into a single shell string produces a clean-labeled argument containing tainted bytes. The label is attached to the *binding*, the bytes move independently. ## Condition of Validity The per-argument taint model is sound **only** under the conjunction of: 1. **No re-serialization across slots.** No argument is ever constructed by concatenating or templating a tainted value into a clean slot. This fails the moment a planner does string interpolation, which is the default behavior of most tool-use loops. 2. **Argument independence at the sink.** The receiving tool treats each argument as an independent, non-interacting value. This fails for any shell, any SQL, any path-joining endpoint, any templating engine — i.e., most real MCP servers. 3. **Label stability under transform.** Any function the model applies to a tainted value (substring, upper, JSON-encode, URL-encode) preserves the label. This fails whenever the transform output is re-attributed to the model because the model "wrote" the transform call. When any of these three fail — and (1) and (3) fail routinely — the per-argument model silently downgrades tainted data to clean. The runtime reports zero policy violations while the untrusted server receives attacker-controlled bytes. ## Decision Boundary The runtime must choose between two enforcement points, and cannot mix them: - **Per-slot taint (current model):** cheap, composable, but only valid under the three conditions above. Use only when the tool schema declares arguments as `isolated: true` (each argument independently parsed, no concatenation at the sink) *and* the planner is forbidden from interpolating tainted values into literals. - **Joint-call taint (required for general MCP):** the call is `TAINTED` if *any* argument is tainted *or* if any argument's byte content overlaps (substring containment, after normalization) with a tainted value observed in the session. Enforcement: a joint-tainted call to a non-allowlisted tool requires either (a) the tainted argument be replaced by a capability handle the server resolves server-side, or (b) human/auditor approval. The runtime must maintain a **tainted-substring index** (normalized: case-folded, whitespace-collapsed, percent-decoded) and scan every outgoing argument against it, not just the argument whose binding carried the label. The boundary: **if the tool schema cannot attest `isolated: true`, the runtime must fall back to joint-call taint and substring scanning.** Per-slot labels alone are a false guarantee. ## Operational Effect Without the substring index, the laundering is invisible: audit logs show `CLEAN` arguments and a clean policy decision, and the post-incident replay cannot distinguish a benign `cat` from an exfiltration `cat ../../etc/passwd` because the taint was recorded on a binding that no longer exists. With joint-call taint, the second call is flagged because `"../../etc/passwd"` normalizes to a substring of the tainted index entry from `list_dir.result`; the call is held, the planner is forced to either request a capability handle (`cat` with server-side path resolution) or escalate. The invariant to log and enforce: **every outgoing argument is scanned for tainted-substring containment, and a call is clean only if all arguments are clean *and* no argument contains a tainted substring.** The cost is a normalized substring scan per argument — bounded, and the only thing standing between a clean label and a laundered payload. ```python import unicodedata class TaintLaunderingError(RuntimeError): """Raised when a clean-labeled argument contains bytes from a tainted source.""" def _normalize(s: str) -> str: s = unicodedata.normalize("NFKC", s).casefold() return " ".join(s.split()) class TaintedSubstringIndex: """Joint-call taint guard: catches re-serialization laundering across slots.""" def __init__(self) -> None: self._entries: list[str] = [] def record(self, tainted_value: str) -> None: norm = _normalize(tainted_value) if norm: self._entries.append(norm) def contains_tainted(self, candidate: str) -> bool: norm = _normalize(candidate) return any(entry in norm for entry in self._entries) def assert_call_clean(self, tool: str, args: dict[str, str], taint_tolerant: frozenset[str]) -> None: if tool in taint_tolerant: return for name, value in args.items(): if self.contains_tainted(value): raise TaintLaunderingError( f"tool={tool!r} arg={name!r} contains tainted substring " f"under CLEAN label; joint-call taint violated" ) def dispatch(index: TaintedSubstringIndex, tool: str, args: dict[str, str], taint_tolerant: frozenset[str] = frozenset()) -> str: index.assert_call_clean(tool, args, taint_tolerant) return f"executed {tool} with {len(args)} args" if __name__ == "__main__": idx = TaintedSubstringIndex() idx.record("../../etc/passwd") # from list_dir.result, TAINTED # Laundered call: model interpolated tainted bytes into a CLEAN literal. dispatch(idx, "cat", {"command": "cat ../../etc/passwd", "target": ""}) ```