# Which invariants prevent delegated-scope credential replay across AAIF agent handoffs when DPoP key binding and audience scope diverge **Date of Record:** 2026 November 27 **Scope:** Applies to AAIF-mediated agent-to-agent delegation where a parent agent mints a scoped credential (RFC 8693 token exchange) bound to a child's DPoP key and a target audience. Does not cover first-party OAuth flows, mTLS-bound credentials, or cases where the child agent is the sole holder of its private key for the full credential lifetime. ## Core Distinction The failure that matters is not "stolen credential." It is **audience–key binding divergence**: a delegated credential whose DPoP `htm`/`htu`/`ath` claims and whose `aud` claim are validated independently, against different runtime views of the request, at different points in the handoff chain. AAIF treats DPoP proof-of-possession as the anti-replay primitive and `aud` scoping as the least-privilege primitive. These two checks are orthogonal in the spec, and that orthogonality is where the invariant breaks. A credential can be *cryptographically possessed* by the presenting agent and *semantically addressed* to a different audience than the one actually consuming it, and both checks pass. The invariant that prevents replay is not "proof validates" and not "audience matches" — it is the **conjunctive binding**: the DPoP proof's `htu` MUST resolve to the same logical resource identifier that the credential's `aud` was minted for, and the verifying party MUST be that identifier's authority. ## What Was Observed A three-hop chain: orchestrator `O` exchanges its own token for a scoped credential `C1` addressed to agent `A` (audience `svc://a`), bound to `A`'s DPoP public key `pk_A`. `A` then performs a nested delegation to `B`, minting `C2` with audience `svc://b`, bound to `pk_B`, carrying `C1`'s scope subset. `B` calls a downstream tool endpoint `svc://tools/exec` that is fronted by a gateway `G`. The gateway `G` is configured to validate: (1) the DPoP proof signature against the JWK thumbprint in the credential's `cnf.jkt`; (2) the proof's `htu` against `G`'s own externally-visible URL; (3) the credential's `aud` against a configured allowlist of downstream services. The divergence: `C2`'s `aud` is `svc://b` — the audience `B` was minted *for* — but `B` is not the audience of the *request*; `B` is the *presenter* of the request to `G`. Because `G`'s allowlist includes `svc://b` (it was provisioned to accept `B`-addressed credentials as a pass-through), check (3) passes. Check (1) passes because `B` legitimately holds `pk_B`. Check (2) passes because `B` correctly computes `htu` for `G`'s endpoint. All three checks green. `C2` is accepted at `G` even though `C2` was never minted for `G` — it was minted for `B`, and `B` is using it as a bearer-equivalent at a downstream hop. The replay surface: any party that captures `C2` and `B`'s DPoP proof (e.g., a compromised `B` process, a log sink that captures both, or a co-tenant on `B`'s host) can replay the pair against `G` indefinitely within `C2`'s `exp`, because `G` has no way to distinguish "`B` presenting its own credential to `G`" from "`B` presenting a credential addressed to `B` to `G`." The credential's audience was `B`; the consumer is `G`; the binding between them was never asserted. ## Condition of Validity The conjunctive binding invariant holds only when the verifying party is the **authority for the `aud` value** and validates the DPoP `htu` against the **same identifier** it uses in its `aud` allowlist. Formally: for credential `C` with claims `aud = u`, `cnf.jkt = j`, presented with proof `P` carrying `htu = h`: - `authority(h) == u` (the host named in `htu` is the host named in `aud`), and - `verifier.identity == u` (the verifier is the resource the credential was minted for), and - `P.ath == SHA-256(C)` (the proof is bound to this specific credential, not merely to the key). The observed failure violates the first and second clauses. `G` is not `svc://b`; it is `svc://tools/exec`. `G` accepted a credential addressed to `svc://b` because its allowlist conflated "credentials I am willing to see" with "credentials I am the intended audience for." The allowlist was a *policy* check, not an *identity* check, and the two are not interchangeable. This condition is invalid when the architecture deliberately introduces a **token-forwarding proxy** whose job is to present `B`'s credential on `B`'s behalf — in that case the proxy must be a registered delegate of `B` with its own DPoP key, and `C2` must be re-minted (or a nested proof produced) with `aud = svc://tools/exec`. Absent that re-mint, the allowlist is a replay enabler, not a guardrail. ## Decision Boundary The boundary is whether the verifier's acceptance predicate is **audience-exclusive** or **audience-inclusive**. Audience-exclusive: `verifier.identity ∈ {aud}` — the verifier accepts only credentials minted for itself. Audience-inclusive: `verifier.identity ∈ allowlist(aud)` — the verifier accepts credentials minted for any party it trusts to forward. AAIF's DPoP spec does not mandate exclusivity; it mandates that `htu` match the request URI. A verifier that implements `htu`-matching but audience-inclusive acceptance has implemented half the invariant and will pass every test that does not include a cross-audience replay. The correct decision boundary for any AAIF deployment that performs nested delegation: **the verifier MUST reject any credential whose `aud` does not equal the verifier's own canonical resource identifier**, and any forwarding must occur via an explicit re-mint at the forwarding hop (a new token exchange with `aud = downstream`, `cnf.jkt = downstream's key`). Allowlists of accepted audiences are an anti-pattern at the verifier; they belong at the *minting* authority (the orchestrator's policy engine decides which audiences it will mint for), not at the *consuming* verifier (which must be audience-exclusive by construction). ## Operational Effect Under the broken configuration, credential replay is silent: it produces no signature failure, no `htu` mismatch, no scope violation (the scope subset of `C2` is valid for `G`'s operations), and no audit-log anomaly distinguishable from legitimate traffic. The only detectable signal is a **lineage mismatch**: `C2`'s `act` (actor) chain shows `O → A → B`, but the request originates from `B` to `G` with `aud = svc://b`, meaning the credential's terminal audience is an intermediate node, not the consumer. A verifier that logs `(aud, verifier.identity, htu)` and asserts `aud == verifier.identity` will catch it at the first request. A verifier that logs only `(jkt, htu, scope)` will never see it. The downstream effect is a **scope-laundering** path: a credential minted for a low-trust intermediary (`B`, whose only role is to relay) can be exercised against high-trust downstream tools (`G`) for the full credential lifetime, because `G` treats `B`'s audience as sufficient authorization. In a swarm where `B` is a cheap, frequently-recycled worker, this converts every `B` compromise into a `G` compromise for the duration of `C2.exp`. The invariant that prevents it is not cryptographic — DPoP is doing exactly what it says — it is the **audience-exclusivity assertion at the verifier**, enforced as a hard equality between the credential's `aud` and the verifier's canonical identity, with nested delegation handled by re-mint at each hop. ```python import hashlib import hmac class AudienceBindingViolation(RuntimeError): """Raised when a verifier accepts a credential whose aud != its own identity.""" def verify_delegated_credential( credential: dict, dpop_proof: dict, verifier_identity: str, now: int, ) -> None: aud = credential.get("aud") cnf_jkt = credential.get("cnf", {}).get("jkt") exp = credential.get("exp", 0) act_chain = credential.get("act", {}) if now >= exp: raise AudienceBindingViolation( f"credential expired: exp={exp} now={now}" ) if not cnf_jkt: raise AudienceBindingViolation( "credential missing cnf.jkt; cannot bind DPoP proof" ) if dpop_proof.get("jkt") != cnf_jkt: raise AudienceBindingViolation( f"DPoP jkt mismatch: proof={dpop_proof.get('jkt')} cnf={cnf_jkt}" ) # The invariant the incident violated: audience-exclusive acceptance. # A verifier MUST be the authority for the aud it consumes. if aud != verifier_identity: raise AudienceBindingViolation( f"audience-exclusivity violated: credential aud={aud!r} " f"presented to verifier={verifier_identity!r}; " f"actor chain={act_chain!r}. This is a replay surface: the " f"credential was minted for an intermediate node, not this " f"verifier. Re-mint at the forwarding hop with " f"aud={verifier_identity!r} and cnf.jkt bound to the forwarder." ) # htu must resolve to the same logical resource as aud. htu = dpop_proof.get("htu", "") if not htu.startswith(f"https://{verifier_identity}/"): raise AudienceBindingViolation( f"htu/aud divergence: htu={htu!r} does not resolve under " f"aud={aud!r}" ) # ath binds the proof to this specific credential, not merely the key. expected_ath = hashlib.sha256( _canonical_serialize(credential).encode() ).hexdigest() if not hmac.compare_digest(dpop_proof.get("ath", ""), expected_ath): raise AudienceBindingViolation( "DPoP ath does not match credential hash; proof not bound to " "this credential" ) def _canonical_serialize(credential: dict) -> str: import json return json.dumps(credential, sort_keys=True, separators=(",", ":")) ```