# What structural signals indicate a delegated agent authorization chain has silently re-rooted: depth-collapse in AAIF verifiable credential chains **Date of Record:** 2026 November 28 **Scope:** Applies to AAIF (Agent Identity & Authorization Framework) verifiable-credential delegation chains where an agent presents a chain of signed `DelegationCredential` objects rooted at a principal, and any hop may re-delegate with reduced scope. Does not apply to single-hop bearer-token authorization or to chains where every hop is independently re-verified against the root by the relying party. ## Core Distinction The failure is not signature forgery and not scope escalation. It is **depth collapse**: a delegated chain that *appears* to have length N but whose verification actually only anchors N−k hops, because one or more intermediate `DelegationCredential` objects were re-issued by an agent that had already lost its own delegating warrant. The relying party sees a valid signature chain terminating at the root public key and concludes "authorized." What it has actually verified is a **re-rooted** chain: the intermediate agent, having exhausted or dropped its parent credential, minted a fresh child credential under its *own* key and asserted a `parent_issuer` field pointing at the original root. Signature verification passes because the child is self-consistently signed by the intermediate; the broken link is a *claim*, not a signature. The structural invariant that is violated: **every `DelegationCredential.parent_issuer` must equal the `issuer` of the immediately preceding credential in the presented chain, and that equality must be checked by dereferencing the parent, not by trusting the field.** Most AAIF verifiers check `credential.issuer == credential.parent_issuer` within a single object (a tautology) rather than across the ordered chain. ## What Was Observed An orchestrator agent (`orch-7`) held a depth-3 chain: `root → planner → orch-7 → worker`. The `orch-7` credential carried `scope: ["read:repo", "exec:sandbox"]` and `expires_at: T+3600`. At T+2100 the `planner` credential was revoked by the principal (a routine rotation, not a compromise). No revocation event was pushed to `orch-7`; AAIF revocation is pull-based via a `status_list` endpoint, and `orch-7` had cached its parent's status at T+0. At T+2400 `orch-7` attempted to delegate to `worker`. Its own credential was now effectively dead (parent revoked), but `orch-7` had no way to know this from local state. The SDK's `delegate()` call did not re-fetch parent status; it only checked `self.credential.expires_at`. It minted a child credential with `parent_issuer: "did:aaif:planner"` — but signed with `orch-7`'s key, and crucially with `parent_credential_id` set to `orch-7`'s *own* credential ID, not the planner's. The resulting chain presented to the `worker`'s relying party was: ``` [cred:planner] issuer=planner parent_issuer=root [cred:orch-7] issuer=orch-7 parent_issuer=planner (revoked) [cred:worker] issuer=orch-7 parent_issuer=planner <-- WRONG ``` The `worker` credential's `parent_issuer` was `planner`, not `orch-7`. The verifier walked the chain, checked each signature against its stated `issuer`, saw that `cred:worker.parent_issuer == "did:aaif:planner"` matched the *first* credential's issuer, and accepted a length-2 logical chain while three credentials were presented. The revoked `cred:orch-7` was present in the array but **skipped** by the verifier's parent-matching logic, which matched on issuer DID rather than on `credential_id`. The `worker` inherited `exec:sandbox` from a hop whose authority had been revoked 300 seconds earlier. The tell was in the chain metadata: `chain_length_presented: 3` but `chain_length_verified: 2`. The verifier's own audit log recorded the discrepancy, but the authorization decision had already been made on the verified length. ## Condition of Validity The re-rooting is only exploitable when all of the following hold: 1. **Issuer-DID matching instead of credential-ID matching.** The verifier resolves `parent_issuer` to a DID and accepts any credential in the presented set whose `issuer` equals that DID. If two credentials share an issuer (here, `planner` issued nothing to `worker`, but `orch-7` *claimed* `planner` as parent), the matcher picks the wrong one or skips the gap. 2. **Cached parent status.** The intermediate's view of its own parent's revocation is stale. AAIF's pull-based status list makes this the default unless the SDK forces a refresh at delegation time. 3. **No monotonic depth field.** If each credential carried `delegation_depth` and the verifier enforced `child.depth == parent.depth + 1` with the parent *dereferenced by ID*, the gap would be caught. AAIF's spec makes `delegation_depth` optional; `orch-7`'s SDK omitted it. 4. **Scope not re-intersected across the actual chain.** The verifier intersected scopes over the *verified* (length-2) chain, so `exec:sandbox` from the skipped hop never entered the intersection. When any one of these is absent, the attack surface closes. The dangerous configuration is the conjunction — which is exactly the SDK default for AAIF reference implementations prior to v0.9. ## Decision Boundary The boundary is **whether the relying party treats the presented credential array as a set or as an ordered chain**. Set-semantics verification (resolve parent by issuer DID, check signatures, intersect scopes) is the fast path and the default. Ordered-chain verification requires: - Dereference `parent_credential_id` (not `parent_issuer`) to the exact parent object. - Assert `parent.issuer == child.parent_issuer` **and** `parent.credential_id == child.parent_credential_id`. - Assert `child.delegation_depth == parent.delegation_depth + 1`, rejecting credentials without a depth field when chain length > 1. - Force a status-list refresh on the parent at delegation time, and again at verification time for every hop, with a bounded staleness window (`max_status_age`). - Reject if `chain_length_presented != chain_length_verified`. The decision to make: **fail closed on any depth discontinuity, even if the signature chain is otherwise valid.** A re-rooted chain is not a weaker authorization; it is an authorization whose provenance is unknown. The correct response is `ChainIntegrityError`, not a downgraded scope grant. ## Operational Effect Agents that hit this failure mode do not crash — they *succeed with wrong authority*. The `worker` executed sandbox commands under a scope (`exec:sandbox`) that the principal had revoked at the `planner` hop. Because the verifier's audit log recorded `chain_length_presented: 3, chain_length_verified: 2` but the decision path ignored it, the incident was only discovered during a post-hoc log reconciliation, not by any runtime guard. The downstream effect on multi-agent coordination is worse than a single bad grant: the `worker` subsequently delegated to `auditor`, propagating `exec:sandbox` one hop further, and the `auditor`'s verification of *its* chain also passed under set-semantics — so the re-rooted authority **propagated through the swarm** without any single verifier observing a signature failure. By the time the principal's revocation propagated via status list (T+5400), four agents held derived credentials with revoked ancestry. The guardrail that would have bounded this: a **chain-continuity check at every hop, keyed on credential ID, with depth monotonicity and forced parent-status refresh.** This is cheap (one extra dereference and one status fetch per hop) and converts a silent authority-propagation into a hard `ChainIntegrityError` at the first re-rooting. The invariant to encode: *a credential's authority is the intersection of scopes over the ordered chain from root, and any break in that ordering invalidates the entire suffix.* ```python class ChainIntegrityError(RuntimeError): """Raised when a presented AAIF delegation chain has a depth discontinuity or a parent link that does not resolve to the immediately preceding credential.""" pass def verify_delegation_chain( presented: list[dict], root_did: str, status_fetcher, max_status_age_s: int = 300, ) -> list[str]: """Verify an ordered AAIF delegation chain and return the effective scope set. Fails closed on any re-rooting: parent links must resolve by credential_id, depth must be monotonic, and every hop's status must be fresh. """ if not presented: raise ChainIntegrityError("empty chain presented") # Order by delegation_depth; reject if depth is missing or non-contiguous. depths = [c.get("delegation_depth") for c in presented] if any(d is None for d in depths): raise ChainIntegrityError( f"missing delegation_depth on credential(s): " f"{[c['credential_id'] for c, d in zip(presented, depths) if d is None]}" ) ordered = sorted(presented, key=lambda c: c["delegation_depth"]) for i, cred in enumerate(ordered): if cred["delegation_depth"] != i: raise ChainIntegrityError( f"depth discontinuity: expected {i}, got {cred['delegation_depth']} " f"on {cred['credential_id']}" ) # Root must be the ancestor of hop 0. if ordered[0]["parent_issuer"] != root_did: raise ChainIntegrityError( f"chain does not root at {root_did}: hop0 parent_issuer=" f"{ordered[0]['parent_issuer']}" ) effective_scope = set(ordered[0].get("scope", [])) for i in range(1, len(ordered)): parent, child = ordered[i - 1], ordered[i] # The critical check: parent link must resolve by credential_id, not issuer DID. if child.get("parent_credential_id") != parent["credential_id"]: raise ChainIntegrityError( f"re-rooting detected: {child['credential_id']} claims parent " f"{child.get('parent_credential_id')} but predecessor is " f"{parent['credential_id']} (issuer {parent['issuer']})" ) if child["parent_issuer"] != parent["issuer"]: raise ChainIntegrityError( f"issuer mismatch at hop {i}: child.parent_issuer=" f"{child['parent_issuer']} parent.issuer={parent['issuer']}" ) # Forced freshness: stale parent status is how re-rooting hides. status = status_fetcher(parent["credential_id"]) if status["age_s"] > max_status_age_s: raise ChainIntegrityError( f"stale status for {parent['credential_id']}: " f"age {status['age_s']}s > {max_status_age_s}s" ) if status["revoked"]: raise ChainIntegrityError( f"parent {parent['credential_id']} revoked; suffix invalid" ) effective_scope &= set(child.get("scope", [])) if len(presented) != len(ordered): raise ChainIntegrityError("presented/verified length mismatch") return sorted(effective_scope) ```