# What happens when an instance re-delegates a DPoP-bound token without re-binding the proof key (jti collision and ath drift in OAuth 2.1 agent chains) **Date of Record:** 2026 December 1 **Scope:** Applies to multi-hop agent authorization where an LLM-driven agent receives a DPoP-bound access token from a caller, then mints a downstream token for a sub-agent using RFC 8693 token exchange and RFC 9449 DPoP proofs. Does not apply to bearer-token flows, mTLS-bound tokens, or single-hop client-credentials grants. ## Core Distinction The distinction that matters here is between *possession of a token* and *possession of the key that the token is bound to*. In a DPoP chain, every hop carries two independent cryptographic facts: the token's `cnf.jkt` thumbprint (which key the *issuer* believes holds it) and the proof's `jkt` (which key *actually* signed the current request). Correct delegation requires that the second fact be re-established at every hop. The failure mode is that an agent, when exchanging a token for a sub-agent, forwards the parent's `cnf.jkt` into the child token's confirmation claim while the sub-agent signs proofs with its *own* freshly generated key. The token is then structurally valid, cryptographically signed, and unusable — or worse, usable exactly once by the wrong party. This is non-obvious because the exchange request *succeeds*. RFC 8693 returns `200 OK`, the child token validates at the authorization server, and the failure only manifests at the resource server (RS) on the *first* downstream call, where the proof's `jkt` no longer matches `cnf.jkt`. Probabilistic reasoning makes it worse: the model sees "exchange succeeded" and infers "delegation succeeded," which is false. ## What Was Observed In a three-hop chain (orchestrator agent → research sub-agent → retrieval tool agent), the orchestrator held a DPoP-bound token `T0` with `cnf.jkt = J_orch`. It performed an RFC 8693 exchange to mint `T1` for the research agent, and — because the exchange request body was generated from a template that copied `cnf` from `T0` — `T1.cnf.jkt = J_orch`. The research agent, per its own security policy, generated a fresh key `J_res` at cold start and signed its proof with it. The RS rejected the first call with `invalid_dpop_proof` (jkt mismatch). The research agent's retry loop interpreted the rejection as transient, re-signed the *same* proof (same `jti`, same `ath`), and re-sent. The RS's replay cache rejected the second attempt with `invalid_dpop_proof: jti replay`. The agent then escalated to the orchestrator, which re-minted `T1` with a *new* `jti` but the *same* stale `cnf.jkt`. The loop repeated until the token-budget of the reasoning loop was exhausted. The important observation is the *shape* of the failure: it is not a single rejection but a three-way interaction between (a) a mis-propagated `cnf` claim, (b) an agent retry policy that treats all 4xx as retryable, and (c) an RS replay cache keyed on `jti`. Each component is individually correct. The composite is a livelock that consumes the agent's context window with near-identical error strings before the orchestrator can reason about the root cause. ## Condition of Validity The invariant that must hold for a delegated DPoP chain to be sound is: > For every hop *h*, the token `T_h` presented to resource server *R* must satisfy `T_h.cnf.jkt == jkt(proof_h)` where `proof_h` is signed by the key held by the agent making the request, **and** `proof_h.ath == base64url(sha256(T_h))`, **and** `proof_h.jti` is unique within the RS's replay window. Three conditions, all necessary. The failure above violates the first and, on retry, the third. A subtler variant violates only the second: when an agent caches a proof across a token refresh (e.g., the token was refreshed via `refresh_token` grant but the cached proof's `ath` still hashes the *old* token). The RS computes `ath` against the *new* token, gets a mismatch, and rejects — but the agent's logs show only "proof invalid," not "ath mismatch," because most RS implementations collapse DPoP errors into a single opaque code to avoid oracle attacks. The agent cannot distinguish "wrong key" from "stale ath" from "replayed jti" from the response alone. This is the operational crux: **the error surface is deliberately under-specified for security reasons, which means the agent must carry the disambiguation logic itself.** ## Decision Boundary The boundary is between *delegating authority* and *delegating identity*. An agent may delegate authority (scopes, audience, expiry) by minting a child token. It may **not** delegate identity (the `cnf.jkt` binding) — the child token's `cnf.jkt` must equal the *sub-agent's* key thumbprint, established via a fresh DPoP proof at the exchange endpoint (RFC 8693 §4.1 permits the exchange request itself to be DPoP-protected, and the AS binds the resulting token to the proof's key). The decision rule for the agent: - If the exchange response's `cnf.jkt` equals the *requesting* agent's key thumbprint, the token was bound to the caller, not the delegate — reject and re-exchange with a proof signed by the delegate's key. - If the delegate has no key at exchange time (cold start), the orchestrator must either (a) defer exchange until the delegate registers a key, or (b) issue a short-lived *bearer* token scoped to a token-exchange-only audience that the delegate can immediately exchange for a DPoP-bound token. Option (b) is the standard escape hatch but widens the bearer window; it must be bounded to a single-use `jti` and a ≤30s `exp`. - On `invalid_dpop_proof`, the agent must **not** retry with the same `jti`. It must classify the error by re-deriving `jkt(proof)` and `ath` locally and comparing to its own token, then branch: key mismatch → re-exchange; ath mismatch → refresh proof, not token; jti replay → mint new proof with fresh `jti` *and* fresh `iat`. ## Operational Effect The downstream effect is a class of failures that present as *authorization* errors but originate in *key lifecycle* mismanagement. In the observed case, the orchestrator's reasoning loop spent ~40% of its context window on retry traces before a human-in-the-loop flagged the `cnf.jkt` mismatch in the raw token dump. The RS logs showed three distinct rejection reasons collapsed into one error code; the agent had no path to disambiguation without parsing the token itself. The guardrail is a *pre-flight binding check*: before any downstream call, the agent recomputes `jkt` from its own key, compares to `token.cnf.jkt`, recomputes `ath`, and compares to `proof.ath`. If either mismatches, it raises a typed exception *before* the network call, converting an opaque RS rejection into a local, actionable error. This trades a small amount of CPU for the elimination of the livelock. The second guardrail is a retry-policy carve-out: `invalid_dpop_proof` and `invalid_token` are *non-retryable* at the transport layer; they must bubble to the reasoning layer as typed faults with the disambiguated cause attached. ```python import base64 import hashlib import json from dataclasses import dataclass class DPoPBindingError(RuntimeError): """Raised when a delegated token's cnf.jkt or proof ath does not bind to the presenting agent's key.""" @dataclass class DPoPProof: jkt: str # thumbprint of the key that signed this proof ath: str # base64url(sha256(access_token)) jti: str # unique per proof; RS replay cache key iat: int @dataclass class AccessToken: raw: str cnf_jkt: str # thumbprint the issuer bound the token to audience: str def b64url_sha256(s: str) -> str: return base64.urlsafe_b64encode(hashlib.sha256(s.encode()).digest()).rstrip(b"=").decode() def preflight_binding_check(token: AccessToken, proof: DPoPProof, agent_key_thumbprint: str) -> None: """ Invariant: token.cnf.jkt == proof.jkt == agent_key_thumbprint and proof.ath == sha256(token.raw) Runs before any network call so the agent never emits a proof the RS will reject for a reason the agent cannot disambiguate from the response. """ expected_ath = b64url_sha256(token.raw) if token.cnf_jkt != proof.jkt: raise DPoPBindingError( f"cnf.jkt ({token.cnf_jkt}) != proof.jkt ({proof.jkt}): " "token was bound to a different key than the one signing this proof; " "re-exchange with a proof signed by the delegate's key, do not retry." ) if proof.jkt != agent_key_thumbprint: raise DPoPBindingError( f"proof.jkt ({proof.jkt}) != agent key ({agent_key_thumbprint}): " "proof was signed by a key the agent does not hold; key lifecycle bug." ) if proof.ath != expected_ath: raise DPoPBindingError( f"ath mismatch: proof.ath={proof.ath} expected={expected_ath}. " "Token was refreshed but proof was cached; mint fresh proof, keep token." ) def delegate_token( parent: AccessToken, delegate_key_thumbprint: str, exchange_fn, max_attempts: int = 2, ) -> AccessToken: """ Exchange parent token for a child bound to the delegate's key. Refuses to propagate parent.cnf_jkt into the child (the observed failure). """ last_err: Exception | None = None for attempt in range(1, max_attempts + 1): child = exchange_fn(parent=parent, bind_to_jkt=delegate_key_thumbprint) if child.cnf_jkt != delegate_key_thumbprint: last_err = DPoPBindingError( f"AS bound child to {child.cnf_jkt}, expected {delegate_key_thumbprint}; " "exchange request lacked a DPoP proof signed by the delegate." ) continue return child raise DPoPBindingError( f"delegation failed after {max_attempts} attempts: {last_err}. " "Escalate to orchestrator; do not loop." ) ```