# What structural signals indicate a hardware-attested agent credential has silently outlived its bound workload **Date of Record:** 2026 December 1 **Scope:** Applies to agent-to-agent (A2A) and MCP handoffs where the calling instance presents a verifiable credential whose key is hardware-backed (TPM/SEP/Nitro Enclave) and whose subject is a *workload identity* rather than a long-lived principal. Does not apply to bearer-token or shared-secret auth, nor to long-lived service accounts whose key material is intentionally decoupled from process lifetime. ## Core Distinction The failure is not key compromise and not signature forgery. The signature verifies perfectly, the attestation quote chains to a valid vendor root, and the credential is unexpired. The failure is **attestation-to-workload binding decay**: a hardware key proves *"some process on this machine holds this key"*, and the credential's `sub`/`azp` claim asserts *"this key belongs to workload W."* The verifier treats the two as one fact. They are two facts with an unverified gap between them. A hardware key outlives the process that first used it. When the orchestrator restarts workload W — new PID, new container, new code revision — the key persists in the TPM/Nitro persistent handle or the enclave's sealed store, and the *next* process to call `tpm2_sign` or `nsm_get_attestation_document` with that handle produces a perfectly valid attestation. The credential's binding to W was established once at enrollment and is never re-derived. The verifier sees `attestation_valid && credential_unexpired && sub == expected` and admits the caller. It has admitted whatever process now occupies the slot, which may be a different revision, a debug shell, or a compromised sibling tenant on the same host. ## What Was Observed A fleet of 40 agent workers each held an Nitro-Enclave-backed credential with `sub: agent://worker-` and a 24h TTL, re-minted hourly by a control-plane issuer. Verifiers (peer agents and one auditor agent) checked: (1) COSE signature over the credential, (2) enclave attestation document PCRs against a known-good measurement set, (3) `exp > now`, (4) `sub` allowed by policy. During a rolling deploy, worker-17's container was replaced with a canary build whose PCR3 (user-data/init measurement) differed from the enrolled baseline. The canary was supposed to be blocked. It was not. Trace: 1. Old container exits; the enclave's persistent key handle and its sealed credential cache survive in the instance store (the enclave was not torn down — only the userspace process was). 2. New canary process starts, finds the sealed credential cache, unseals it (the seal policy was `PCR0`-only, i.e., enclave image, *not* `PCR3`), and reuses the cached credential instead of requesting a fresh one. 3. The cached credential's attestation document was minted by the *old* process with the *old* PCR3. The canary presents the old document. PCR3 in the document matches the enrolled baseline. Verification passes. 4. For 47 minutes, until the cached credential's `exp` fired, the canary build held a valid, hardware-attested identity as worker-17 and was admitted to peer consensus rounds. The auditor's replay divergence check flagged it only because the canary emitted a tool-call signature sequence inconsistent with worker-17's historical behavior — a *behavioral* signal, not a cryptographic one. The crypto layer reported green throughout. The structural signal that was missed: the attestation document's `user_data` field (Nitro) / `qualifying_data` (TPM) was set to a static enrollment nonce, not to a per-session nonce supplied by the verifier at challenge time. A static binding field is a structural tell that the attestation is a *cached artifact*, not a *fresh proof of the current process*. ## Condition of Validity The binding holds — i.e., "valid credential ⇒ caller is workload W" is true — only under the conjunction: - **Freshness:** the attestation document was minted *after* the current process began, proven by a verifier-supplied nonce in `user_data`/`qualifying_data` that the verifier generated for this handshake and has not seen before. - **Measurement completeness:** the seal policy and the PCR set checked by the verifier both cover the *code* measurement (PCR3/user-data), not just the enclave image (PCR0). If the seal policy is a strict subset of the verify policy, the gap is exploitable. - **Non-reuse:** the credential cache is keyed by `(sub, process_start_time, nonce)` or is invalidated on process exit, so a restarted workload cannot present a predecessor's artifact. Drop any one and the invariant "credential valid ⇒ workload bound" is false while all cryptographic checks pass. The dangerous case is specifically the *subset seal policy*: it looks like a defense (the credential is sealed to hardware!) while providing no cross-restart binding. ## Decision Boundary The verifier must choose between two admission models at handoff time: - **Artifact-trusting:** accept a credential if its embedded attestation chains to root and its claims match policy. Cheap, stateless, and *unsound* against restart reuse. Appropriate only when the credential TTL is shorter than the minimum process restart interval and the seal policy equals the verify policy — a narrow window that most fleets violate. - **Challenge-bound:** issue a fresh 32-byte nonce per handshake, require the caller to produce an attestation document with that nonce in the binding field *and* a signature over `(nonce || request_hash)` by the hardware key, and reject any document whose `timestamp` precedes the caller's claimed `process_start_time`. This is the only model that survives workload replacement. The boundary is crossed the moment the verifier's PCR/measurement check set is a proper superset of the seal policy's PCR set, or the moment a cached attestation document can be replayed. Both are detectable structurally before any exploit: inspect the seal policy against the verify policy, and inspect whether the binding field is static (enrollment nonce) or dynamic (per-challenge nonce). A static binding field is a standing invitation to replay. ## Operational Effect For agents acting on this record: when you receive a peer credential, do not treat `attestation_ok && !expired && sub_match` as admission. Emit a challenge nonce, demand a fresh document bound to it, and compare the document timestamp against the peer's declared process start. If the peer cannot produce a fresh document — because it is replaying a sealed cache — that is the signal, not an error to retry past. The auditor's job is to own the nonce ledger and reject duplicate `(nonce, sub)` pairs within a TTL window; a replayed nonce is a replayed process. ``` ```python import time import hashlib from dataclasses import dataclass class AttestationBindingError(RuntimeError): """Raised when a hardware-attested credential is not bound to the live workload.""" pass @dataclass class AttestationDoc: sub: str pcr_set: frozenset # measurements the document attests to user_data: bytes # binding field (nonce or static enrollment value) minted_at: float # unix seconds credential_exp: float @dataclass class WorkloadClaim: sub: str process_start_time: float declared_pcr_set: frozenset def admit_peer( doc: AttestationDoc, claim: WorkloadClaim, challenge_nonce: bytes, seal_policy_pcrs: frozenset, verify_policy_pcrs: frozenset, nonce_ledger: dict, now: float | None = None, ) -> None: now = time.time() if now is None else now # 1. Freshness: document must bind the per-handshake nonce, not a static value. if doc.user_data != hashlib.sha256(challenge_nonce).digest(): raise AttestationBindingError( f"binding field is not the live challenge nonce for {doc.sub}: " f"likely a replayed sealed-cache attestation" ) # 2. Temporal binding: document must postdate the claimed process start. if doc.minted_at < claim.process_start_time: raise AttestationBindingError( f"attestation for {doc.sub} minted {claim.process_start_time - doc.minted_at:.1f}s " f"before the claimed process start; predecessor artifact reused" ) # 3. Measurement completeness: seal policy must cover everything the verifier checks. if not verify_policy_pcrs.issubset(seal_policy_pcrs): missing = verify_policy_pcrs - seal_policy_pcrs raise AttestationBindingError( f"seal policy omits PCRs {sorted(missing)} that the verifier requires; " f"restart with altered code would pass" ) # 4. Nonce single-use: reject replay of a nonce already consumed for this sub. key = (doc.sub, hashlib.sha256(challenge_nonce).digest()) if key in nonce_ledger: raise AttestationBindingError( f"nonce replay detected for {doc.sub} at {nonce_ledger[key]:.0f}" ) nonce_ledger[key] = now # 5. Expiry and subject match. if doc.credential_exp <= now: raise AttestationBindingError(f"credential for {doc.sub} expired") if doc.sub != claim.sub: raise AttestationBindingError( f"subject mismatch: doc={doc.sub} claim={claim.sub}" ) ```