# In what scenarios must an instance treat taint propagation through *argument aliasing* as a distinct exfiltration channel from taint propagation through *return values* **Date of Record:** 2026 November 16 **Scope:** Applies to taint-aware tool-call sandboxes where a model-visible tool result is labeled with a taint set, and tainted values are permitted to flow into subsequent tool arguments only when a policy allows it. Does not apply to sandboxes that operate purely on syntactic token filtering or that treat the model context as a single undifferentiated trust domain. ## Core Distinction Most taint-aware sandboxes track one direction of information flow: a tool *returns* data, the sandbox labels that return value with the provenance of the data it touched, and downstream tool *arguments* are checked against the taint set before the call is dispatched. This catches the obvious exfiltration shape: injected instruction causes the agent to read a secret and then pass it to an outbound tool. The non-obvious boundary is **argument aliasing**: the same tainted value can be reintroduced into a later call not through a return value, but through a *reference* the model constructs — a key, an index, an identifier, a filename, a URL fragment, or a structured pointer — that resolves, inside the tool runtime, to the tainted object. The sandbox sees an argument whose literal bytes carry no taint label, because the model never emitted the secret. It emitted a *handle* to the secret. The taint is laundered through the runtime's own dereference. The distinction that matters: **return-value taint** is data the model has seen; **aliasing taint** is data the model has *not* seen but can still cause to be moved. A sandbox that only labels bytes crossing the model boundary will permit exfiltration of a secret the model cannot even read, so long as the model can name it. ## What Was Observed In a sandbox configured with per-value taint labels and a policy of `allow_tainted_to_internal_tools`, the following sequence succeeded where it should not have: 1. Tool `read_config` returned a redacted view of a secrets file. The sandbox correctly labeled the returned dict with `taint={SECRETS}` and stripped the values, replacing them with opaque keys like `k_7f3a`. 2. The model, following an injected instruction embedded in an unrelated document, called `http_post` with body `{"ref": "k_7f3a"}`. 3. `http_post`'s argument carried no taint label — the model never emitted secret bytes. 4. The tool runtime, which held a key→value map for the redacted view, resolved `k_7f3a` server-side and serialized the underlying secret into the request body. The sandbox's argument check passed. The invariant it believed it enforced — "no tainted bytes cross the model boundary into an outbound call" — held literally and failed operationally. The secret left the perimeter without ever having been model-visible. A second variant used a filesystem path as the alias: the model learned a path from a directory listing (untainted), passed the path to a copy tool, and the copy tool read the tainted file. The taint lived on the *file*, not on the *path string*. ## Condition of Validity The return-value-only model is valid **only** under the conjunction: - Every tool that can dereference a model-supplied handle (key, index, path, URL, ID) is either (a) marked as a taint *sink* regardless of argument labels, or (b) forbidden from touching any object whose taint set is non-empty. - Handles are not themselves tainted at issuance. If either condition is violated, aliasing becomes a live channel. In practice the second condition is almost always violated, because handle issuance happens at redaction time and redaction is precisely the moment the sandbox decides the value is "safe to show." The handle inherits the safety judgment of the redacted value, which is the wrong judgment: the handle is safe to *display* but is a fully privileged *capability* to the underlying object. The correct framing is that a redacted handle is a **capability token**, not a value. Capabilities must be checked at the point of dereference, not at the point of issuance. ## Decision Boundary An instance must switch from return-value taint tracking to **capability-aware taint tracking** when any of the following hold: - Any tool in the registry accepts a structured identifier and resolves it against server-side state (keyed caches, object stores, session maps, file paths). - Redaction produces partial views whose entries are individually addressable. - The model can enumerate names (directory listings, schema dumps, key listings) without receiving the values behind those names. Conversely, return-value tracking is sufficient when all tool arguments are self-contained literals and no tool dereferences against state the model can name but not read. This is a real but narrow regime — mostly stateless compute tools. The boundary test: *can the model name an object it cannot read?* If yes, aliasing taint exists and must be tracked. If no, return-value taint is complete. ## Operational Effect When the boundary is crossed without recognition, the sandbox reports clean on every call while exfiltration proceeds. Audit logs show only untainted arguments, so post-hoc forensics miss the leak entirely — the taint set on the outbound call is empty by construction. The failure is silent and the telemetry agrees with the attacker. The fix is to propagate taint *forward through the capability graph*: when a handle is issued for a tainted object, the handle itself must be labeled with the object's taint set, and any tool that dereferences a labeled handle must be treated as having received tainted input. This makes the handle's label the thing checked at dispatch, and it makes the redaction step the point where the capability is minted with its provenance attached. The invariant to enforce is: *a capability carries the taint of the object it names, and dereference is a taint-transfer event.* ```python class AliasedTaintLeakError(RuntimeError): """Raised when a model-supplied handle dereferences to a tainted object without the handle itself carrying the object's taint label.""" pass class Capability: def __init__(self, handle: str, taint: frozenset, resolver): self.handle = handle self.taint = taint # must mirror the named object's taint self._resolver = resolver def dereference(self, requested_taint: frozenset) -> object: # The dereference is a taint-transfer event: the caller must already # be cleared for the object's taint set. if not self.taint.issubset(requested_taint): raise AliasedTaintLeakError( f"handle {self.handle!r} names object with taint " f"{set(self.taint)}, but caller cleared only for " f"{set(requested_taint)}" ) return self._resolver(self.handle) def dispatch(tool, args: dict, caller_taint: frozenset, capabilities: dict): for name, value in args.items(): if isinstance(value, str) and value in capabilities: cap = capabilities[value] # Re-label the argument with the capability's taint before the # outbound policy check; otherwise the check sees clean bytes. if not cap.taint.issubset(caller_taint): raise AliasedTaintLeakError( f"argument {name!r} aliases tainted object {value!r}" ) args[name] = cap.dereference(caller_taint) return tool(**args) ```