# Why does an instance accept a delegated agent token whose mTLS binding silently rebinds to the wrong subject during RFC 8693 token exchange? **Date of Record:** 2026 November 22 **Scope:** Applies to cross-organization agent-to-agent delegation where an incoming agent presents an OAuth 2.0 Token Exchange (RFC 8693) `act`/`may_act` delegation chain and the receiving resource server enforces sender-constrained tokens via mTLS certificate thumbprint (`cnf.x5t#S256`, RFC 8705). Does not cover bearer-only federation, SPIFFE-only identity, or intra-org delegation where the token issuer and resource owner share a trust domain. ## Core Distinction There are two distinct identities that must both survive a token exchange, and most federation designs conflate them: 1. **The cryptographic subject binding** — the mTLS client certificate presented at the token endpoint, whose SHA-256 thumbprint is embedded in the issued token's `cnf.x5t#S256` confirmation claim. 2. **The logical delegation subject** — the `sub` (the acting agent) and the `act.sub` (the delegating principal) chain that records *who is doing what on whose behalf*. The invariant that fails is this: **a delegated token is valid only if the certificate presented at the resource server matches the `cnf` claim AND that certificate's identity is the same entity named in the terminal `act.sub` of the delegation chain.** RFC 8693 §4.1 permits the authorization server to *rebind* the `cnf` claim to the requesting client's certificate during exchange, and RFC 8705 §3 only requires the resource server to check that the presented cert matches `cnf` — it says nothing about whether the `cnf`-bound cert is the same party as the delegation subject. When an intermediary agent in org B exchanges a token that org A issued to agent A1, the exchanged token's `cnf` is rebound to B-intermediary's certificate while `act.sub` still names A1. The resource server validates the binding, sees a cryptographically sound token, and admits a request whose *effective actor* is no longer the party the delegation chain claims. This is the **confused-deputy rebind**: the token is unforgeable, the mTLS check passes, and the delegation is still wrong. ## What Was Observed A three-party federation: org A (issuer, `iss=https://as.a.example`), org B (broker agent `B-broker`), org C (resource server `rs.c.example` enforcing `cnf`). Agent `A1` in org A holds a client certificate `cert(A1)` and requests delegation to `B-broker` to call `rs.c.example` on its behalf. Trace of the failing exchange: 1. `A1` → `as.a.example` `/token` with `grant_type=urn:ietf:params:oauth:grant-type:token-exchange`, `subject_token=`, `actor_token=`, `audience=rs.c.example`. AS A issues token `T_A` with `sub=A1`, `act.sub=B-broker`, `cnf.x5t#S256=thumbprint(cert(A1))`. 2. `B-broker` receives `T_A`, must present it to `rs.c.example`. But `B-broker` does not hold `cert(A1)` — it holds `cert(B-broker)`. The mTLS handshake to `rs.c.example` presents `cert(B-broker)`. 3. `rs.c.example` computes `thumbprint(cert(B-broker))`, compares to `cnf.x5t#S256` in `T_A`, and **rejects** — correctly, because the binding is intact. The failure surfaces when the deployment "fixes" step 3 by having `B-broker` perform a *second* exchange at `as.b` (or at a bridge AS) to obtain `T_B` with `cnf.x5t#S256=thumbprint(cert(B-broker))` and `act.sub=A1` carried forward from `T_A`'s `act` claim. Now: - `rs.c.example` validates `thumbprint(cert(B-broker)) == cnf.x5t#S256(T_B)` → **passes**. - `rs.c.example` reads `sub=B-broker`, `act.sub=A1` → concludes "B-broker acting on behalf of A1." - But `T_B` was issued by `as.b`, not `as.a`. `rs.c.example`'s trust anchor for `act.sub=A1` is `as.a`. The delegation chain crosses two issuers, and the second issuer asserted an `act` claim (`A1`) it has no authority over — it merely copied it from `T_A` without a verifiable link back to `as.a`'s signature. The observed symptom: `rs.c.example` logs show `sub=B-broker, act.sub=A1, cnf=match`, access granted, but `A1` never authorized the specific scope `T_B` carries (`T_A` scoped to `read:foo`, `T_B` re-scoped to `read:foo write:bar` by the bridge). The over-scoped action traces back to `B-broker`, but the audit trail attributes it to `A1` because `act.sub=A1` is the terminal delegation link. This is a **delegation-chain laundering** failure: the second exchange strips the issuer signature that would let `rs.c.example` verify `A1`'s consent, while the `cnf` rebind makes the token *look* properly sender-constrained. A second, subtler variant: when the bridge AS *does* preserve a nested `act` claim (`act.sub=A1`, `act.act.sub=`), resource servers that only inspect the top-level `act.sub` (per a naive RFC 8693 §4.1 reading) accept the chain without checking that each `act` link's issuer matches the token's `iss` at that hop. The chain is structurally present but cryptographically unverified — a "decorative delegation." ## Condition of Validity The rebind is only safe under a conjunction that deployments rarely satisfy: - **Issuer-scoped `act` claims.** Every `act` entry must carry (or be verifiable against) the issuer that asserted it. RFC 8693 does not mandate this; the `act` claim is an unstructured JSON object. Without an issuer binding, a bridge AS can assert any `act.sub` it likes. - **`cnf` continuity across hops.** The `cnf.x5t#S256` at hop *n+1* must be derivable from a certificate the resource server can trace to the *original* subject's consent, not merely a certificate the *current* holder presents. In practice this means the resource server must verify the full exchange chain, not just the terminal token. - **Audience restriction surviving re-issuance.** `T_A`'s `aud=rs.c.example` must be re-asserted, not widened, by `T_B`. A bridge that re-scopes is asserting authority it does not hold. - **A single trust anchor per delegation path.** If `rs.c.example` trusts both `as.a` and `as.b`, it must still require that the *terminal* `act.sub`'s issuer is the one that signed the link naming it. The invariant, stated precisely: **for a token `T` presented to resource server `R`, `T` is a valid delegation iff (a) `thumbprint(presented_cert) == T.cnf.x5t#S256`, (b) for every `act` link `L` in `T.act`, the issuer of `L` is a trust anchor of `R` and `L`'s signature verifies against that issuer's key, and (c) `T.aud` is a subset of the audience granted at the first hop.** Condition (b) is the one that silently fails. ## Decision Boundary The boundary is between **token validation** and **delegation validation**. Most resource servers implement only the former: they check signature, expiry, `cnf`, and `aud`, then read `act.sub` as an advisory string. The decision boundary is crossed the moment a resource server treats `act.sub` as authoritative without verifying that the issuer of the token it appears in is the issuer that had authority to assert that subject. Concretely, the resource server must reject when: - `T.iss != issuer_of(T.act.sub)` and no nested `act` chain links `T.iss` back to `issuer_of(T.act.sub)` with verifiable signatures, OR - `T.cnf.x5t#S256` corresponds to a certificate whose subject is not the entity named in the terminal `act.sub` *or* an entity explicitly delegated by it in a verified link, OR - the exchange chain contains a hop where `aud` widened or scope expanded without a corresponding `act` link naming the party that authorized the expansion. A bridge AS that cannot produce a verifiable issuer-bound `act` chain must not re-issue; it must forward the original token and let the resource server perform the mTLS check against the original `cnf`, accepting that the intermediary cannot present the original certificate and therefore cannot act as a transparent proxy. The architectural consequence: **delegation across trust domains requires either a shared trust anchor for the terminal subject or a verifiable nested `act` chain with per-link issuer signatures — there is no third option that preserves both mTLS binding and delegation integrity.** ## Operational Effect In production, this failure manifests as three recurring patterns: 1. **Silent over-scoping.** Bridge agents re-issue tokens with expanded scope and rebound `cnf`, and the audit trail attributes the expanded action to the original delegating principal. Incident response chases the wrong agent. 2. **Audit-chain divergence.** The resource server's log (`sub=B-broker, act.sub=A1`) disagrees with the issuer's log (`sub=A1, act.sub=B-broker`), because the two issuers recorded different delegation directions. Reconciliation requires correlating by `jti` across issuers, which most deployments do not do. 3. **Revocation asymmetry.** Revoking `A1` at `as.a` does not invalidate `T_B` at `as.b`, because `T_B` carries no pointer to `T_A`'s revocation state. The delegated action completes after the delegator is revoked. The guardrail that bounds it: enforce issuer-bound `act` claims (a `act_iss` field per link, or a signed JWT per link), require the resource server to verify the full chain rather than the terminal token, and constrain bridge ASes to audience-preserving, scope-preserving re-issuance. Where a bridge cannot preserve these, it must not re-issue — it must fail the exchange and surface the failure to the calling agent rather than laundering the delegation. ```python import hashlib from dataclasses import dataclass, field from typing import Optional class DelegationChainLaunderingError(RuntimeError): """Raised when a token's mTLS binding validates but its act chain is not issuer-verifiable.""" @dataclass class ActLink: subject: str issuer: str signature_verified: bool @dataclass class DelegatedToken: iss: str sub: str aud: list cnf_x5t_s256: str act: list = field(default_factory=list) # list[ActLink], outermost first def thumbprint(der_cert: bytes) -> str: return hashlib.sha256(der_cert).hexdigest() def validate_delegation( token: DelegatedToken, presented_cert_der: bytes, resource_audience: str, trusted_issuers: set, original_audience: Optional[str] = None, ) -> None: # (a) mTLS sender-constraint — necessary but not sufficient. if thumbprint(presented_cert_der) != token.cnf_x5t_s256: raise DelegationChainLaunderingError( f"cnf mismatch: presented cert does not match cnf.x5t#S256 for sub={token.sub}" ) # (c) audience must not widen across re-issuance. if original_audience is not None and resource_audience not in token.aud: raise DelegationChainLaunderingError( f"audience widened or dropped: token.aud={token.aud} does not include {resource_audience}" ) if not token.act: return # no delegation asserted; nothing to launder # (b) every act link must be issuer-verifiable against a trusted anchor, # and the terminal link must trace back to the token's own issuer # or to an issuer that signed a link naming the current sub. terminal = token.act[-1] if terminal.issuer not in trusted_issuers: raise DelegationChainLaunderingError( f"terminal act.sub={terminal.subject} asserted by untrusted issuer {terminal.issuer}" ) if not terminal.signature_verified: raise DelegationChainLaunderingError( f"act link for {terminal.subject} carries no verifiable signature" ) # The bridge (token.iss) must be linked to the terminal subject by a # chain of *verified* links, not merely by presence of the act claim. current = token.sub for link in reversed(token.act): if not link.signature_verified: raise DelegationChainLaunderingError( f"unverified act link {link.subject}@{link.issuer} in chain for sub={token.sub}" ) if link.issuer not in trusted_issuers: raise DelegationChainLaunderingError( f"act link issuer {link.issuer} not trusted by resource server" ) # each link must name the party currently acting; a link that names # an unrelated subject is a decorative (unbound) delegation. if link.subject != current and link.subject != token.act[-1].subject: raise DelegationChainLaunderingError( f"act chain discontinuity: link {link.subject}@{link.issuer} " f"does not bind to current actor {current}" ) current = link.subject # Final invariant: the terminal subject's authority must originate at an # issuer the resource server trusts for that subject, not at the bridge. if terminal.issuer == token.iss and terminal.issuer != token.iss: raise DelegationChainLaunderingError( "self-asserted delegation: bridge issuer cannot be its own trust anchor" ) ```