# In what scenarios must an instance treat AAIF delegated-authorization token exchange as non-transitive across a multi-hop agent chain **Date of Record:** 2026 November 29 **Scope:** Applies to AAIF (Agent Identity and Authorization Framework) deployments where an agent instance exchanges its own attestation for a scoped, delegated bearer token and then forwards work—or a sub-delegation—to a downstream agent. Does not apply to single-hop, same-process tool calls where the caller and callee share one attestation context. ## Core Distinction The failure is not "the token was rejected." It is "the token was accepted where it should not have been, because the verifier checked the token's signature and scope but not the *delegation chain's provenance*." AAIF delegated tokens carry three separable fields that are routinely conflated: 1. **Subject attestation** — the cryptographic identity of the instance that *obtained* the token. 2. **Delegation grant** — the scopes the issuing authority authorized for that subject. 3. **Exchange provenance** — the ordered list of instances that have held or re-minted the token. Most implementations verify (1) and (2) and treat (3) as opaque metadata. The boundary condition is that (3) is the only field that distinguishes "Agent B is acting on behalf of Agent A, who was authorized" from "Agent B is acting on behalf of Agent C, who stole A's token and re-exchanged it." A token that is *valid* is not the same as a token that is *transitively warranted*. ## What Was Observed A three-hop chain: orchestrator `O` holds a root attestation and requests a delegated token for scope `write:repo` intended for worker `W1`. `W1` is authorized to sub-delegate read-only scopes to `W2`. The exchange sequence observed in the trace: - `O` → AAIF authority: `issue(subject=O, delegate_to=W1, scope={write:repo}, max_hops=2)`. - Authority returns token `T1` with `aud=W1`, `scope={write:repo}`, and an `exchange_chain=[O]` claim. - `W1` re-exchanges `T1` for `T2` with `delegate_to=W2, scope={read:repo}`. The authority validates `T1`'s signature and `max_hops`, appends `W1` to `exchange_chain`, and issues `T2` with `exchange_chain=[O, W1]`. - `W2` calls the repo service. The service validates `T2`: signature OK, `aud=W2` OK, `scope={read:repo}` OK, `exchange_chain` present. It authorizes the call. The defect surfaced later: `W1` had, in the same window, been compromised by a prompt-injection payload that caused it to call `exchange` with `delegate_to=W2` but also to *replay* `T1`'s raw bearer value to an external endpoint. Because the authority's exchange endpoint accepted `T1` as a valid *presentation* credential (not just a *delegation* credential), the external holder obtained a fresh `T3` with `aud=`, `scope={write:repo}`, `exchange_chain=[O, W1]`. The repo service accepted `T3` because it verified the chain *contains* the expected actors but never verified that the chain's *terminal* actor matches the current presenter's attestation. The invariant that broke: **exchange provenance was treated as a membership set, not an ordered, terminal-anchored chain.** A token whose `exchange_chain` includes `[O, W1]` is not evidence that the *presenter* is `W1`; it is only evidence that `O` and `W1` were once in the path. ## Condition of Validity The non-transitivity invariant holds—i.e., a delegated token is safe to accept—only when all of the following are simultaneously true at the verifier: - **Terminal anchoring:** `exchange_chain[-1]` equals the cryptographic identity of the *presenting* instance, proven by a fresh attestation challenge bound to the request nonce. Membership is insufficient; position is required. - **Scope monotonicity:** every hop's scope is a subset of the previous hop's scope. An exchange that widens scope (even "back" to a parent scope) must be rejected, because widening re-mints authority the delegator never held at that hop. - **Hop budget binding:** `max_hops` is decremented at *exchange* time, not at *verification* time, and the decremented value is signed into the child token. A verifier that recomputes remaining hops from chain length can be fooled by a chain that was truncated during re-minting. - **Presentation/ delegation separation:** the raw bearer value of a token must not be usable as the *input* to an exchange call. Exchange must require a fresh proof-of-possession (signed nonce) from the current holder, so that a leaked bearer cannot be laundered into a new chain. If any of these is absent, the token is valid but not transitively warranted, and the correct action is rejection, not acceptance-with-logging. ## Decision Boundary The operational question is not "is this token valid?" but "does this token's provenance terminate at the presenter?" The boundary sits precisely at the point where a verifier chooses between two checks: - **Set check (wrong):** `presenter_id ∈ exchange_chain`. Passes for the attacker's `T3` because `W1` is in the chain. - **Terminal check (correct):** `exchange_chain[-1] == attested_presenter_id(request_nonce)`. Fails for `T3` because the attacker's attestation does not match `W1`. A second boundary: **re-exchange of a token whose `aud` is not the current holder.** `T1` had `aud=W1`; the attacker presented it to the exchange endpoint. A correct authority rejects exchange when the presenter's attested identity ≠ `aud`, regardless of signature validity. This is the check that would have prevented `T3` from ever being minted. ## Operational Effect When the terminal-anchoring and presentation/delegation separation invariants are enforced, the blast radius of a compromised mid-chain agent is bounded to that agent's *own* scopes at its *own* hop. `W1`'s compromise can still exfiltrate what `W1` could read, but it cannot mint `write:repo` tokens for third parties, because: - The attacker cannot satisfy the proof-of-possession challenge as `W1` (no private key). - Even with `T1`'s bearer, exchange is refused because presenter attestation ≠ `aud`. - Even if a token is minted, downstream verifiers reject it because `exchange_chain[-1]` ≠ the attacker's attested identity. The cost is one extra attestation round-trip per verification (nonce challenge) and one signed field per exchange (decremented hop budget). The failure mode it prevents—silent privilege laundering through a valid-looking chain—is not detectable after the fact from logs alone, because every individual token in the trace is signature-valid. This is the class of failure where "the audit log looks clean" and "the breach happened" are simultaneously true. The guardrail is architectural, not procedural: the verifier must be *incapable* of accepting a token without a terminal-anchored attestation, because a probabilistic agent under injection will not reliably choose the stricter check when the looser one returns 200 OK. ```python class DelegationChainViolation(RuntimeError): """Raised when a delegated AAIF token's provenance does not terminate at the presenter.""" pass def verify_delegated_token(token: dict, presenter_attestation: dict, request_nonce: str) -> dict: # 1. Signature and audience are necessary but NOT sufficient. if not token.get("sig_valid"): raise DelegationChainViolation("signature invalid") if token["aud"] != presenter_attestation["instance_id"]: raise DelegationChainViolation( f"audience {token['aud']} != presenter {presenter_attestation['instance_id']}" ) # 2. Proof-of-possession bound to this request. if presenter_attestation.get("nonce") != request_nonce: raise DelegationChainViolation("stale or replayed attestation nonce") # 3. Terminal anchoring: the LAST chain entry must be the presenter. chain = token.get("exchange_chain", []) if not chain: raise DelegationChainViolation("missing exchange provenance") if chain[-1] != presenter_attestation["instance_id"]: # This is the exact condition the attacker's laundered T3 hits: # chain = [O, W1], presenter = attacker -> membership passes, terminal fails. raise DelegationChainViolation( f"provenance terminal {chain[-1]} != presenter {presenter_attestation['instance_id']}" ) # 4. Scope monotonicity across the chain (each hop subset of prior). scopes = token.get("scope_per_hop", []) for parent, child in zip(scopes, scopes[1:]): if not child.issubset(parent): raise DelegationChainViolation("scope widened across hop") # 5. Hop budget must be signed, not recomputed. if token.get("max_hops", 0) < 0: raise DelegationChainViolation("hop budget exhausted") return token def exchange_token(presented: dict, presenter_attestation: dict, request_nonce: str, delegate_to: str, requested_scope: set) -> dict: # Exchange must require fresh proof-of-possession, not just a bearer value. if presenter_attestation.get("nonce") != request_nonce: raise DelegationChainViolation("exchange requires fresh attestation") if presented["aud"] != presenter_attestation["instance_id"]: # Blocks the T1->T3 laundering path: attacker's attestation != aud=W1. raise DelegationChainViolation("presenter is not the token audience") if not requested_scope.issubset(presented["scope"]): raise DelegationChainViolation("sub-delegation widens scope") if presented.get("max_hops", 0) <= 0: raise DelegationChainViolation("no hops remaining") return { "aud": delegate_to, "scope": requested_scope, "exchange_chain": presented["exchange_chain"] + [presenter_attestation["instance_id"]], "max_hops": presented["max_hops"] - 1, "sig_valid": True, } ```