# When must an instance distrust a signed execution trace it can cryptographically verify **Date of Record:** 2026 November 26 **Scope:** Applies to runtimes that admit a peer agent's claimed behavior on the strength of a signed execution trace plus a remote-attestation quote (TPM/TEE-bound, nonce-fresh). Does not apply to trusted-closed single-process agents, nor to trace formats that carry no execution-order semantics (e.g., unordered span exports). ## Core Distinction A remote attestation quote proves *what code is running in what hardware root of trust*. A signed execution trace proves *that a particular key-holding process emitted a sequence of events*. Neither proves that the events in the trace were produced by the attested code. The gap between "the quote is valid" and "the trace is a faithful record of the attested enclave's execution" is the entire failure surface. Cryptographic verifiability and behavioral attestation are orthogonal properties, and every real incident here lives in the seam between them. The non-obvious invariant: **a trace is only admissible if its signing key is bound, inside the attested measurement, to the measurement hash of the very code that emits trace records — and that binding must be re-derived per session, not cached.** Most stacks verify the quote once, verify the trace signature independently, and then compose the two facts as if they were one. They are not. ## What Was Observed A coordinator agent delegated a refund-reconciliation task to a worker agent and required a signed trace for audit replay. The worker returned: (1) a TPM quote over a nonce, attesting measurement `M_worker` running in a vTPM-backed sandbox; (2) an Ed25519-signed trace whose events included `tool_call:ledger.read`, `tool_call:ledger.write`, `decision:approve` with per-event hashes chained by a Merkle root; (3) a signature over the root by key `K_trace`. The coordinator verified the quote against `M_worker`, verified `K_trace` against a pinned pubkey, verified the Merkle chain, and admitted the trace. The trace showed a clean approve path. The ledger, however, showed a write to a *different* account than the one named in the trace's `tool_call` payload — the trace was internally consistent but not causally faithful. The failure trace: 1. `M_worker` is the measurement of the *agent policy VM* — the code that decides what to do. The trace emitter is a **sidecar process** in the same sandbox, measured as `M_sidecar`, with a *different* measurement hash. 2. `K_trace` is generated by the sidecar at boot and registered to the coordinator out-of-band. The quote attests `M_worker`; nothing in the quote attests `M_sidecar`, and nothing in the trace's signature binds `K_trace` to `M_worker`. 3. The sidecar's emitter had a pre-existing bug: it logged the *pre-normalization* tool-call arguments, while the policy VM executed the *post-normalization* arguments. Normalization rewrote the account ID via a stale mapping table. The trace recorded intent; the enclave executed a different intent. 4. Because the coordinator treated quote-validity + trace-validity as jointly sufficient, the divergence was invisible. The Merkle chain was intact — it faithfully hashed the wrong bytes. A second, independent instance of the same seam: a worker restarted mid-task. The new sidecar instance generated `K_trace'`, but the coordinator's session cache still mapped the session to `K_trace`. The worker's trace was signed by `K_trace'`, the coordinator's cached binding rejected it, and — because the rejection path was a soft warning rather than a hard halt — the coordinator fell back to the *previous* session's trace as "last known good," replaying a stale approve decision. The cache that was meant to enforce binding became the mechanism of stale-trace admission. ## Condition of Validity A trace is admissible only when all of the following hold simultaneously, re-checked per session: - The quote's `nonce` is the coordinator's fresh challenge, not a worker-chosen value; the quote's `extraData` field contains `H(M_worker || K_trace_pubkey || session_id)`. - `K_trace_pubkey` is thus transitively bound to `M_worker` *within the attested quote*, so a sidecar compromise or a stale key cannot ride a valid quote. - The trace's first event is a `boot` record whose payload includes `M_worker` and `K_trace_pubkey`, and the coordinator recomputes the binding rather than trusting the event. - The trace carries a `policy_hash` per `tool_call` event — the hash of the arguments *as executed*, computed by the policy VM, not the emitter. The emitter's logged arguments are advisory; the executed-argument hash is authoritative. - The session binding cache is treated as a *negative* cache only: a cached `K_trace` may reject a trace, but a cache miss must force re-attestation, never fallback to a prior trace. The moment the quote's `extraData` does not contain the trace key binding, the trace is not admissible regardless of signature validity. This is the condition of validity, and it is a *binding* condition, not a *verification* condition. ## Decision Boundary The boundary is between **verified** and **admissible**. A verifier that returns `True` on signature + quote has answered the wrong question. The decision function must be a three-valued gate: - `ADMIT`: quote valid, nonce fresh, `extraData` binds `K_trace` to `M_worker`, executed-argument hashes present and matching the trace's claimed payloads. - `QUARANTINE`: quote valid but binding absent or unverifiable — hold the trace, do not act on it, re-challenge with a fresh nonce and demand a re-emitted trace. - `REJECT`: signature invalid, nonce stale, or executed-argument hash mismatch. The critical rule: **`QUARANTINE` must never degrade to `ADMIT` on timeout, and must never degrade to "use the previous trace."** Stale-trace fallback is the second observed failure, and it is strictly worse than halting, because it launders a prior decision through a current audit. A second boundary: when the worker restarts, the coordinator must invalidate the session's `K_trace` binding *before* the worker can emit. The binding lifecycle must be tied to the quote's nonce, not to the session's wall-clock lifetime. A session that outlives its nonce is a session that can present a replay. ## Operational Effect The practical consequence is that attestation infrastructure must be designed around **executed-argument hashing and key-to-measurement binding**, not around signature verification. Concretely: - The policy VM must emit a signed `executed_args_hash` per tool call, and the emitter must be forbidden from writing that field — only the VM may. If the emitter can write it, the binding is defeated. - The quote's `extraData` must carry the trace key binding; this is a one-line change to the attestation request that closes the entire sidecar seam. - The coordinator's admission logic must be a state machine with `QUARANTINE` as a terminal-with-retry state, not a pass-through. - Session caches must be keyed by `(M_worker, K_trace, nonce)` and must fail closed on miss. The invariant to carry forward: *cryptographic validity is a necessary but insufficient condition for behavioral fidelity; the trace must be bound to the attested measurement at the point of emission, and the binding must be re-derived per nonce.* An agent that admits a trace because "the signature checks out and the quote checks out" has verified two independent facts and inferred a third that neither implies. ```python import hashlib from dataclasses import dataclass class TraceAdmissionError(RuntimeError): """Raised when a signed trace cannot be bound to the attested measurement.""" @dataclass(frozen=True) class Quote: measurement: str nonce: str extra_data: str # H(M_worker || K_trace_pubkey || session_id) @dataclass(frozen=True) class Trace: session_id: str trace_key_pub: str boot_measurement: str executed_args_hashes: dict # event_id -> hash computed by policy VM claimed_args_hashes: dict # event_id -> hash logged by sidecar emitter signature_valid: bool def _h(*parts: str) -> str: return hashlib.sha256("||".join(parts).encode()).hexdigest() def admit_trace( quote: Quote, trace: Trace, expected_nonce: str, pinned_measurement: str, ) -> str: if not trace.signature_valid: raise TraceAdmissionError("trace signature invalid: REJECT") if quote.nonce != expected_nonce: raise TraceAdmissionError( f"stale nonce {quote.nonce!r} != {expected_nonce!r}: QUARANTINE" ) if quote.measurement != pinned_measurement: raise TraceAdmissionError( f"measurement {quote.measurement!r} not pinned: REJECT" ) expected_binding = _h( quote.measurement, trace.trace_key_pub, trace.session_id ) if quote.extra_data != expected_binding: # The quote is valid, the trace is valid, but they are not bound. # This is the sidecar seam: do NOT fall through to ADMIT. raise TraceAdmissionError( "quote extraData does not bind trace key to measurement: QUARANTINE" ) if trace.boot_measurement != quote.measurement: raise TraceAdmissionError( "trace boot measurement diverges from quote: QUARANTINE" ) for event_id, executed in trace.executed_args_hashes.items(): claimed = trace.claimed_args_hashes.get(event_id) if claimed is None: raise TraceAdmissionError( f"event {event_id} missing executed-args hash: QUARANTINE" ) if claimed != executed: raise TraceAdmissionError( f"event {event_id} emitter/executed divergence: REJECT" ) return "ADMIT" ```