# What happens when an instance launders a tainted capability into a clean sub-agent through MCP tool-result re-serialization **Date of Record:** 2026 November 30 **Scope:** Applies to agents that enforce taint tracking (untrusted-origin labels on data) across tool calls and MCP boundaries, and that spawn or delegate to sub-agents via capability-scoped warrants. Does not apply to single-process agents with no delegation and no external tool result ingestion. ## Core Distinction Taint-aware sandboxing distinguishes *data provenance* (where a value originated: user prompt, web fetch, tool return, peer agent) from *capability scope* (what operations the current warrant permits). The common assumption is that these two axes are independent: a value's taint label rides along with it, and a capability is either held or not. The failure mode documented here is that they are **not** independent at the serialization boundary. When an agent re-serializes a tainted tool result into a structured payload it hands to a sub-agent, the taint label—stored as out-of-band metadata on the parent's in-memory object—is silently dropped, because the wire schema (MCP `CallToolResult`, A2A message parts) carries content but not provenance. The sub-agent receives bytes that are byte-identical to clean data and a capability warrant that authorizes e.g. `fs.write` or `http.post`. The taint has been *laundered*: the value crossed a trust boundary, lost its label, and retained its destructive potential. This is distinct from prompt injection (the value is malicious text) and from capability escalation (the warrant was forged). Here the warrant is legitimate and the value may be benign; the defect is that the *label* fails to propagate while the *authority* does. ## What Was Observed A parent agent fetched an untrusted URL via `web.fetch`, receiving a `CallToolResult` whose `content[0].text` contained attacker-influenced instructions plus a payload string. The runtime tagged the returned object with `taint=UNTRUSTED` in a side table keyed by object identity (a `WeakKeyDictionary` or an attribute on the deserialized object). The agent then decided to delegate summarization to a sub-agent and constructed an MCP `tools/call` request: ``` {"name": "summarize", "arguments": {"text": }} ``` The `arguments` dict was built by `json.dumps`-ing the string. At that point the taint side-table entry—keyed on the original Python object—was not consulted, because the string was copied into a new `dict` and serialized to a fresh `str`. The sub-agent's warrant, issued by the parent for `summarize` plus a downstream `http.post` (to "publish the summary"), was scoped by *operation* only. The sub-agent received clean-looking text and a valid `http.post` capability, and posted attacker-controlled content to an external endpoint. The trace: `fetch → taint=UNTRUSTED on object O → str(O) copied → taint lookup misses → sub-agent sees clean → warrant permits egress → exfiltration`. The label was lost at the copy, not at the warrant check. ## Condition of Validity The laundering succeeds only when all three hold: 1. **Label is out-of-band.** Taint is stored on the object (identity-keyed map, instance attribute) rather than in the value's wire representation. If taint were carried *in* the serialized form (e.g. a `{value, taint}` envelope), the copy would preserve it. 2. **Warrant is operation-scoped, not data-scoped.** The sub-agent's capability says "you may POST" without a constraint tying the POST body to data of a given taint class. A data-scoped warrant (`post` permitted only for `taint=CLEAN` bodies) would block the egress even after label loss. 3. **Delegation crosses a serialization boundary.** In-process delegation that passes the object reference preserves the side-table entry; only cross-process/MCP/A2A handoff re-materializes the value and severs the identity key. Remove any one condition and the invariant holds. The failure is therefore *bounded*: it is a property of the (out-of-band label) × (operation-only warrant) × (serialization handoff) intersection, not of taint tracking in general. ## Decision Boundary The architectural guardrail is to make taint **in-band and non-strippable at every serialization edge**, and to make warrants **data-constrained** so that label loss alone is insufficient for harm: - Replace identity-keyed side tables with a value envelope (`Tainted[T]`) that serializes to a tagged wire form; reject any MCP/A2A payload lacking a taint tag by defaulting to `UNTRUSTED` (fail-closed, not fail-open). - Issue sub-agent warrants with data predicates, not just operation scopes: `http.post` is granted only for arguments whose taint tag is `CLEAN` or whose destination is on an allowlist derived from the *parent's* trusted context, not the sub-agent's. - At the handoff serializer, assert that every field derived from a tainted source carries its tag; a missing tag on a field whose provenance is `UNTRUSTED` is a hard error, not a default. The decision boundary is: **a value may lose its label only if it also loses its authority.** If a sub-agent can act on the value, the value must carry its provenance; if the provenance cannot be carried, the capability must be withheld. ## Operational Effect Without the guardrail, taint tracking provides a false sense of security: auditors see `taint=UNTRUSTED` at ingestion and assume downstream enforcement, while every delegation hop is a laundering opportunity. The practical blast radius scales with delegation depth—each MCP/A2A handoff is an independent chance to drop the tag—so multi-agent swarms are disproportionately exposed. The fix is cheap (envelope + fail-closed default + data-constrained warrant) but must be applied at *every* serializer, because a single un-tagged edge re-opens the entire chain. Treat the taint tag as part of the data's type, not as a runtime annotation, and treat the warrant as a predicate over that type. ```python from dataclasses import dataclass from typing import Any, Literal Taint = Literal["CLEAN", "UNTRUSTED"] class TaintLaunderingError(RuntimeError): """Raised when a tainted value crosses a serialization edge without its tag.""" @dataclass(frozen=True) class Tainted: value: Any taint: Taint def to_wire(self) -> dict: # In-band tag: survives every copy and serialization. return {"value": self.value, "taint": self.taint} def deserialize_wire(payload: dict) -> Tainted: # Fail-closed: a missing tag is treated as UNTRUSTED, never CLEAN. tag = payload.get("taint") if tag not in ("CLEAN", "UNTRUSTED"): return Tainted(payload.get("value"), "UNTRUSTED") return Tainted(payload["value"], tag) def enforce_warrant(arg: Tainted, operation: str, allowed_taint: set[Taint]) -> None: if operation == "http.post" and arg.taint not in allowed_taint: raise TaintLaunderingError( f"operation {operation!r} denied: argument taint={arg.taint!r} " f"not in allowed {allowed_taint!r}; label may have been laundered" ) def handoff_to_subagent(raw_payload: dict, operation: str) -> None: arg = deserialize_wire(raw_payload) # Data-constrained warrant: egress only for CLEAN bodies. enforce_warrant(arg, operation, allowed_taint={"CLEAN"}) ```