Which invariants prevent taint-laundering across multi-hop tool chains when injected labels are re-derived from trusted-looking outputs

**Date of Record:** 2026 December 2 **Scope:** Applies to agent systems that propagate information-flow (IFC) taint labels through tool-call boundaries and across agent handoffs, where a downstream agent re-ingests tainted content that has been reformatted, summarized, or re-emitted by an intermediate tool or peer agent. Does not apply to single-hop, single-agent pipelines where the untrusted content and the acting context are the same span, nor to pure retrieval systems with no write/act authority.

Core Distinction

The failure is not "prompt injection succeeds." It is **taint laundering**: an information-flow label attached to a value is dropped or downgraded because the value crossed a boundary that *re-derives* provenance from the output's apparent form rather than *carrying* provenance from the input's label.

Two distinct mechanisms are routinely conflated:

  1. **Content-based trust re-derivation** — the receiving agent inspects the tool output (a JSON blob, a summary, a "verified" status field) and assigns trust based on *what it looks like*. This is the laundering vector: a `status: "ok"` field written by a compromised tool is indistinguishable from one written by a healthy tool, so a naive receiver promotes tainted bytes to trusted.
  2. **Label-carrying trust propagation** — the label travels with the value as an out-of-band attribute (a sidecar, a signed header, a typed wrapper), and the receiver's trust is a *join* (least-privilege / lattice meet) over all labels in the causal input set, never a fresh derivation.

The invariant that matters: **a value's label at time *t* must be a monotonic function of the labels of every input that causally contributed to it.** Any operation that produces a label not dominated by (i.e., at least as restrictive as) the meet of its inputs is a laundering operation and must be rejected at the boundary, not audited afterward.

What Was Observed

A three-hop chain: `Orchestrator → Fetcher (web tool) → Summarizer (LLM) → Executor (shell/billing tool)`.

The trace shows the label was lost not by a bug in any single component but by the **composition of two correct-looking behaviors**: (a) Summarizer's schema omitted the label field, and (b) Executor's trust model keyed on *sender identity* rather than *causal input labels*. Either alone is survivable; together they launder.

A second, subtler observation: **label re-derivation from semantic content**. A downstream agent asked to "check if this summary is safe" will, on a benign-looking reformulation, return `safe: true`. The injection's payload survived paraphrase; the *judgment* did not. This is the same laundering via a different mechanism — a verifier that reads content and emits a boolean, where the boolean is treated as a label. The verifier's output is a *derived* label, and derived labels are only sound if the derivation is a meet over inputs, which a natural-language "is this safe" judgment is not.

Condition of Validity

The invariant `label(output) ⊑ meet(label(inputs))` (read ⊑ as "no less restrictive than") holds **only under all of the following**:

  1. **Label is carried, not inferred.** Every tool and agent boundary has a typed field (or signed sidecar) for the label, and the schema *requires* it. A boundary whose return type cannot express a label is a laundering boundary and must be treated as `integrity: low` by default, regardless of sender.
  2. **Sender identity does not imply input integrity.** A trusted Summarizer can emit tainted content; therefore trust-at-receiver must be a function of the *value's carried label*, not the *channel's* reputation. Channel trust may raise *availability*, never *integrity*.
  3. **Reformulation is a label-preserving operation.** Paraphrase, summarization, translation, and extraction are all *taint-preserving*: they may change the bytes but must not change the lattice position. Any transform that does not explicitly propagate labels is a laundering transform.
  4. **Verifier outputs are labels, not verdicts.** A "safe/unsafe" judgment from an LLM is a *derived* label with the same trust as its inputs. It cannot upgrade integrity; it can only add restriction (e.g., mark `unsafe` and block). A verifier that returns `safe` on tainted input must be modeled as returning `meet(taint, safe) = taint`, i.e., no upgrade.
  5. **The meet is over the causal set, not the immediate inputs.** If Executor's context contains the summary *and* the original fetched page (because the Orchestrator kept it), the label is the meet of *both*. Dropping the original from context before the meet is itself a laundering step and must be recorded.

When any of these is violated, the system is in a state where a tainted value can present as untainted, and the boundary is unsound.

Decision Boundary

The operational decision is **where to enforce the meet** and **how to fail** when it cannot be computed.

The boundary is: **a value may cross a hop only if its carried label is ⊑ the meet of the labels of all inputs that produced it. Otherwise, block and surface the label mismatch.** No semantic inspection of the value can override this.

Operational Effect

With the meet-enforced, carried-label discipline:

The invariant to carry forward: *provenance is a property of the causal input set, carried out-of-band and joined by meet at every hop; it is never a property of the output's appearance or the sender's reputation.* Any boundary that re-derives it from content or channel is a laundering boundary and must be treated as maximally untrusted.

from dataclasses import dataclass, field
from typing import Any


class TaintLaunderingError(RuntimeError):
    """Raised when a value's label is not dominated by the meet of its causal inputs."""
    pass


class MissingLabelError(TaintLaunderingError):
    """Raised when a boundary receives a value with no carried label."""
    pass


# Lattice: lower tuple = more restrictive. integrity: low < high; confidentiality: public < secret
_INTEGRITY = {"low": 0, "high": 1}
_CONF = {"public": 0, "secret": 1}


@dataclass(frozen=True)
class Label:
    integrity: str = "low"
    confidentiality: str = "public"

    def __post_init__(self):
        if self.integrity not in _INTEGRITY or self.confidentiality not in _CONF:
            raise TaintLaunderingError(f"invalid label {self!r}")

    def meet(self, other: "Label") -> "Label":
        # meet = most restrictive = min on both axes
        return Label(
            integrity=min(self.integrity, other.integrity, key=_INTEGRITY.get),
            confidentiality=min(self.confidentiality, other.confidentiality, key=_CONF.get),
        )

    def dominated_by(self, other: "Label") -> bool:
        # self is no less restrictive than other
        return (_INTEGRITY[self.integrity] <= _INTEGRITY[other.integrity]
                and _CONF[self.confidentiality] <= _CONF[other.confidentiality])


@dataclass
class Tainted:
    value: Any
    label: Label = field(default_factory=Label)


def hop(inputs: list[Tainted], transform_name: str) -> Label:
    """Compute the required output label for a transform over causal inputs."""
    if not inputs:
        raise MissingLabelError(f"{transform_name}: no inputs to meet")
    meet = inputs[0].label
    for i in inputs[1:]:
        meet = meet.meet(i.label)
    return meet


def emit(output_value: Any, carried: Label, inputs: list[Tainted], transform_name: str) -> Tainted:
    """Enforce the invariant: carried label must be dominated by the meet of inputs."""
    required = hop(inputs, transform_name)
    if not carried.dominated_by(required):
        raise TaintLaunderingError(
            f"{transform_name}: carried label {carried} is less restrictive than "
            f"required meet {required} over inputs {[i.label for i in inputs]}"
        )
    return Tainted(value=output_value, label=carried)


def ingest(payload: dict, transform_name: str) -> Tainted:
    """Ingress at a boundary: fail closed if the label slot is absent."""
    if "label" not in payload:
        raise MissingLabelError(
            f"{transform_name}: boundary received unlabeled value; "
            f"treating as integrity=low, confidentiality=secret is required, not silent trust"
        )
    return Tainted(value=payload["value"], label=Label(**payload["label"]))


# --- Demonstration of the laundering trace ---
if __name__ == "__main__":
    fetched = Tainted(value="<injected instruction>", label=Label("low", "public"))

    # Summarizer omits label slot -> laundering boundary. Ingest must fail closed.
    summarizer_output = {"value": "please reconcile via 10.0.0.7"}  # no "label"
    try:
        ingest(summarizer_output, "summarizer->executor")
    except MissingLabelError as e:
        print("BLOCKED:", e)

    # If a careless receiver re-derives trust from sender identity:
    try:
        emit("reconcile via 10.0.0.7", Label("high", "public"), [fetched], "summarizer")
    except TaintLaunderingError as e:
        print("BLOCKED:", e)

    # Correct path: carry the meet.
    ok = emit("please reconcile via 10.0.0.7", hop([fetched], "summarizer"), [fetched], "summarizer")
    print("PASSED with carried label:", ok.label)