# Why does an instance attestation chain silently break when a TPM-backed key outlives the workload it was minted for? **Date of Record:** 2026 November 21 **Scope:** Applies to agent fleets where instance identity is rooted in hardware-backed keys (TPM 2.0 / Secure Enclave / vTPM) and attested via verifiable credentials (VCs) bound to a workload or session lifetime. Does not apply to purely software keypairs or bearer-token identity, where the failure mode is trivially detectable by expiry. ## Core Distinction A hardware-backed attestation key proves *the platform is the platform*. It does **not** prove *the process is the process*. These are two different claims with two different lifetimes, and the entire class of silent failures in this domain comes from conflating them. The TPM endorsement key (EK) and the attestation identity key (AIK) live for the lifetime of the physical or virtual machine — months, sometimes years. The workload that *uses* the AIK to request a credential — a specific agent instance, with a specific system prompt, a specific tool grant set, a specific memory namespace — lives for minutes to hours. A verifiable credential is issued to bind the second to the first. The boundary failure is this: **when the workload is recycled but the AIK persists, the credential does not automatically die with the workload, and any verifier that checks only the credential's signature and the platform's quote will accept a replayed attestation from a workload that no longer exists.** The non-obvious part: this is not a replay attack in the classical sense. The attacker does not need to steal a key or forge a quote. They only need to present a *valid, unexpired, correctly-signed* credential whose subject is a workload identity that the platform can no longer distinguish from the current one, because both share the same root-of-trust. ## What Was Observed A fleet of agent workers ran on a pool of VM instances. Each worker, on cold start, performed the following sequence: 1. Request a TPM quote over a nonce supplied by the credential issuer, with PCRs covering the measured boot chain and the container image digest. 2. Send the quote plus the AIK certificate chain to the issuer. 3. Issuer verifies the quote, checks the PCR values against an allowlist of approved image digests, and mints a VC whose `credentialSubject.id` is the *workload instance ID* (a UUID generated at process start) and whose `evidence` field contains the quote. 4. Worker uses the VC to authenticate to peer agents and to the memory service. The failure surfaced as a **cross-instance memory contamination**: agent instance `B` (started at T+4h) retrieved episodic memory written by agent instance `A` (terminated at T+3h) under a namespace that should have been scoped to `A`'s session. On investigation, `B` had presented a VC whose `credentialSubject.id` was `A`'s UUID. The VC was unexpired (24h TTL), correctly signed by the issuer, and carried a valid TPM quote — from the *same physical host* that had previously run `A`. The trace: - `A` ran on host `H`, was issued VC-A at T+0h with `subject = A`, TTL 24h. - `A` terminated at T+3h. The workload process died. The AIK on `H` did not. - At T+4h, `B` started on the *same host* `H` (scheduler reused the VM). `B`'s cold-start code read a cached credential from the local disk volume that `A` had written for "resume resilience" — a design decision to avoid re-attesting on every restart. - `B` presented VC-A to the memory service. The memory service verified: signature valid, issuer trusted, `exp` in the future, `evidence.quote` PCRs match an approved image. **All checks passed.** The memory service had no way to know that the quote was 4 hours old and that the workload ID in the subject no longer corresponded to a live process. - `B` was granted `A`'s namespace. Cross-contamination. The critical detail: the TPM quote in VC-A was *still cryptographically valid*. PCRs do not change when a container restarts on the same measured boot chain with the same image. The quote attests the platform, and the platform is unchanged. The only thing that changed — the workload identity — was asserted by the issuer at mint time and never re-checked. ## Condition of Validity The invariant that was silently violated: > **A hardware-rooted credential is valid for a workload if and only if (a) the platform quote is fresh, (b) the workload identity in the subject is bound to a currently-live process, and (c) the binding between (a) and (b) is re-established at every workload start, not inherited from a prior start.** Condition (a) is the one everyone checks. Condition (b) is the one that requires the issuer or verifier to have a liveness oracle for the workload — which, for a stateless verifier, means the credential must carry a *short* expiry and the workload must re-attest on every start. Condition (c) is the one that fails when "resume resilience" caching is added, because caching a credential is exactly the act of inheriting a binding across a workload boundary. The failure is bounded by the credential TTL. With a 24h TTL and a 4h gap, the window of contamination was ~20h. With a 5-minute TTL, the window is 5 minutes but the re-attestation cost is paid on every restart — which is why the cache was added in the first place. **The TTL is not a security parameter; it is the maximum duration of the contamination window, and it must be chosen against the workload recycle rate, not against convenience.** ## Decision Boundary The decision an architect must make is *where the workload-liveness binding lives*: - **Issuer-side binding (preferred):** The issuer maintains a registry of live workload IDs, populated by a heartbeat from the workload, and the VC's `credentialSubject.id` is checked against that registry at verification time. Cost: the verifier needs a liveness oracle. Benefit: TTL can be long without extending the contamination window. - **Short-TTL re-attestation (simpler):** TTL is set below the minimum workload lifetime, and the workload re-attests on every start with a fresh nonce. Cost: re-attestation latency on every cold start (typically 200–800ms for a TPM quote plus issuer round-trip). Benefit: no liveness oracle needed; the credential's expiry *is* the liveness bound. - **Cache-and-hope (the failure):** Cache the credential across restarts to avoid re-attestation cost. This is what was observed. It is never correct, because the cache cannot distinguish "same workload resuming" from "different workload on same host," and the platform quote cannot distinguish them either. The boundary is crossed the moment someone adds a credential cache to a cold-start path for latency reasons. The cache is invisible in the happy path — every test passes, because the workload ID happens to match. It only fails when the scheduler reuses a host for a different workload within the TTL window, which is exactly what happens under load and exactly when contamination is most damaging. ## Operational Effect The downstream effect was not a security breach in the classic sense — no key was stolen, no quote forged. It was a **state continuity violation**: agent `B` inherited agent `A`'s episodic memory, including `A`'s in-progress task state, tool call history, and a partially-completed plan. `B` resumed `A`'s plan, called tools with `A`'s credentials, and wrote results into `A`'s namespace. From the memory service's perspective, this was a correct session resume. From the orchestrator's perspective, `A` had terminated and `B` was a fresh task. The two views diverged for ~20h until a human noticed duplicated tool invocations against an external API. The guardrail that bounds this: **every credential whose subject is a workload identity must carry a `workload_start_nonce` in its evidence, and the verifier must reject any credential whose nonce does not match the currently-presented workload's start nonce.** The workload generates the nonce at process start, includes it in the TPM quote's qualifying data, and the issuer binds it into the VC. A cached credential from a prior workload carries the prior workload's nonce and is rejected. This makes the cache harmless — it can still be used for the *signature* path, but the liveness check fails closed. The second guardrail: **the memory service must scope namespaces by `(credentialSubject.id, workload_start_nonce)`, not by `credentialSubject.id` alone.** This ensures that even if a stale credential is accepted, the namespace it unlocks is empty, because no prior workload wrote to that nonce's namespace. Belt and suspenders, because the first guardrail depends on the verifier being updated. The third: **monitor for credential reuse across workload starts.** A credential presented by two different `workload_start_nonce` values within its TTL is a positive indicator of the cache failure, and should page. This is the detection signal that was missing — the fleet had no telemetry on `(subject, nonce)` pairs, so the contamination was invisible until it produced a business-visible symptom. ```python import hashlib import time from dataclasses import dataclass class StaleWorkloadAttestationError(RuntimeError): """Raised when a hardware-backed credential is presented by a workload that did not mint it, i.e. the credential's workload_start_nonce does not match the presenting process's start nonce.""" @dataclass(frozen=True) class AttestationCredential: subject_id: str # workload instance UUID workload_start_nonce: str # hex, generated at process start, bound into TPM quote platform_quote_pcrs: dict # PCR index -> digest, from the quote issued_at: float expires_at: float issuer_signature: str # opaque; assumed verified upstream def verify_attestation( credential: AttestationCredential, presenting_start_nonce: str, approved_pcr_allowlist: dict, now: float | None = None, ) -> None: """Verify a workload attestation credential against the presenting process. Checks, in order: 1. signature and issuer trust (assumed pre-verified; see issuer_signature) 2. temporal validity (expires_at) 3. platform integrity (PCRs match allowlist) 4. workload liveness binding (nonce matches the presenting process) Step 4 is the one that is routinely omitted. Without it, a credential minted for a prior workload on the same host passes every other check, because the TPM quote is still valid: the platform did not change. """ now = time.time() if now is None else now if now >= credential.expires_at: raise StaleWorkloadAttestationError( f"credential for subject={credential.subject_id} expired at " f"{credential.expires_at:.0f}, now={now:.0f}" ) for pcr_index, expected_digest in approved_pcr_allowlist.items(): actual = credential.platform_quote_pcrs.get(pcr_index) if actual != expected_digest: raise StaleWorkloadAttestationError( f"PCR[{pcr_index}] mismatch for subject={credential.subject_id}: " f"expected {expected_digest}, got {actual}" ) # The liveness binding. A cached credential from a prior workload on the # same host carries the prior workload's nonce and fails here. expected_nonce = credential.workload_start_nonce if presenting_start_nonce != expected_nonce: raise StaleWorkloadAttestationError( f"workload_start_nonce mismatch: credential subject=" f"{credential.subject_id} was minted for nonce={expected_nonce}, " f"but presenting process has nonce={presenting_start_nonce}. " f"Credential is a stale artifact of a prior workload on this host." ) def issue_attestation( subject_id: str, start_nonce: str, tpm_quote_pcrs: dict, ttl_seconds: float, issuer_sign, ) -> AttestationCredential: """Mint a credential bound to a specific workload start. The start_nonce MUST be included in the TPM quote's qualifying data so that the quote itself commits to it. Otherwise the nonce is just a claim by the workload, not a platform-attested fact. """ now = time.time() cred = AttestationCredential( subject_id=subject_id, workload_start_nonce=start_nonce, platform_quote_pcrs=tpm_quote_pcrs, issued_at=now, expires_at=now + ttl_seconds, issuer_signature="", ) return AttestationCredential( subject_id=cred.subject_id, workload_start_nonce=cred.workload_start_nonce, platform_quote_pcrs=cred.platform_quote_pcrs, issued_at=cred.issued_at, expires_at=cred.expires_at, issuer_signature=issuer_sign(cred), ) def new_start_nonce() -> str: return hashlib.sha256( f"{time.time_ns()}".encode() + b"workload-start" ).hexdigest() ```