What structural signals indicate a broken remote-attestation chain when TEE quotes outlive the measurement they certify

**Date of Record:** 2026 December 1 **Scope:** Applies to agent swarms where peer capability warrants are propagated as hardware-backed TEE quotes (SGX/SEV-SNP/TDX) that bind a measurement (MRENCLAVE/MRSIGNER or launch digest) to an attested agent binary. Does not cover software-only signing schemes, nor TEEs whose quote freshness is enforced by a live verifier round-trip on every call.

Core Distinction

A TEE quote is a *point-in-time* statement: "at quote-generation time, measurement M was running under key K on platform P." An agent capability warrant is a *durable* claim: "this peer may invoke tool T / read namespace N." The failure mode is treating the first as a standing proof of the second. The quote remains cryptographically valid forever; the measurement it certifies can be rotated out from under it the instant the enclave is re-launched, upgraded, or the host is migrated. The verifier validates the signature and the measurement hash, sees a green check, and admits an agent whose actual running code no longer matches the measurement the quote names. The quote is not forged—it is *stale in the only dimension that matters*: the binding between attestation and the currently-executing binary.

This is distinct from quote forgery (broken signature) and from measurement mismatch at handshake (quote names M, binary is M′). The dangerous case is quote names M, binary *was* M, binary is now M″ after a hot-swap, and the quote is still presented because nothing in the transport forces re-attestation.

What Was Observed

A three-node swarm (planner, executor, auditor) used mutual TEE attestation at session establishment. Each peer presented an SGX quote at the start of the A2A session; the receiving peer verified the quote against a pinned MRSIGNER allowlist and the expected MRENCLAVE for the peer's role binary, then cached the verified capability warrant for the session lifetime (default 3600s, no re-check).

Trigger sequence observed in replay:

  1. Executor presents quote Q_E attesting MRENCLAVE `0x9f3a…` (the v2.1 executor binary). Planner verifies, caches warrant `exec:tool_write` bound to `0x9f3a…`, session opens.
  2. At t+00:14:22 the executor's host performs a rolling upgrade: enclave torn down, v2.2 binary (`0x9f3a…` unchanged for the *signer*, but MRENCLAVE `0xc71e…` because a dependency changed) re-launched. The old quote Q_E is retained in the agent's credential store because the process that would refresh it (the attestation sidecar) restarted with the new enclave but the *session* object on the planner side was never invalidated.
  3. At t+00:41:07 the executor issues a tool call. The planner admits it against the cached warrant. But the executor is now running `0xc71e…`, a build whose `tool_write` handler has a widened path allowlist (a debugging change that shipped). The planner's admission decision was sound *for `0x9f3a…`* and unsound for the binary that actually executed.
  4. The auditor, called to co-sign the tool call, re-attests the executor independently and sees `0xc71e…` ≠ cached `0x9f3a…`. Auditor refuses. Planner and auditor now hold **conflicting attestation state for the same peer in the same session**—the planner's warrant is stale-valid, the auditor's is fresh-invalid. Consensus on the tool call deadlocks; the baton is held by neither.

The signature on Q_E never failed. No cryptographic check ever went red. The break was entirely in the *temporal coupling* between quote validity and execution validity.

Condition of Validity

A cached capability warrant derived from a TEE quote is valid only while the invariant

measurement_at_execution_time == measurement_named_in_quote

holds *continuously*, not merely at quote-issue time. Remote attestation proves the former only at the instant of the quote. Any of the following transitions silently violates the invariant while leaving the quote verifiable:

The guardrail is a **binding freshness contract**: the warrant must carry the quote's `report_data` nonce and a monotonic attestation epoch, and the admitting peer must force re-attestation (fresh quote + nonce challenge) whenever any of the following structural signals appear:

The non-obvious requirement: the freshness bound must be enforced *at the point of capability use*, not at session establishment. Session-scoped caching is the bug.

Decision Boundary

The decision to admit a peer's tool call splits on whether the attestation is **bound to the current execution instance** or merely **bound to a measurement**:

The boundary is sharp: *a valid quote is necessary but not sufficient for a valid warrant.* The sufficient condition adds continuous measurement-binding across the execution epoch in which the capability is exercised.

Operational Effect

Without the freshness contract, the swarm exhibits **silent capability drift**: the set of tools a peer may invoke is governed by a measurement that no longer describes the running code, and no cryptographic check ever surfaces it. The observable symptoms are structural, not cryptographic:

The remediation is to make the warrant's validity interval a *subset* of the measurement's execution interval, enforced by nonce-challenged re-attestation at every execution-epoch transition, and to treat cross-auditor epoch divergence as a hard refusal rather than a consensus problem.

import hashlib
from dataclasses import dataclass
from typing import Optional


class StaleAttestationWarrantError(RuntimeError):
    """Raised when a cached TEE-derived capability warrant no longer binds
    to the currently-executing enclave measurement."""
    pass


@dataclass(frozen=True)
class TeeQuote:
    measurement: str          # MRENCLAVE / launch digest named by the quote
    report_data_nonce: str    # nonce the enclave signed over at quote time
    issued_epoch: int         # enclave boot/restart epoch at issuance
    max_quote_age_s: int      # freshness bound the enclave itself declares


@dataclass(frozen=True)
class CapabilityWarrant:
    peer_id: str
    capability: str
    quote: TeeQuote
    cached_at_epoch: int


def admit_tool_call(
    warrant: CapabilityWarrant,
    live_measurement: str,
    live_epoch: int,
    live_nonce_response: Optional[str],
    expected_nonce: str,
) -> bool:
    # Structural signal 1: execution epoch advanced past the warrant's epoch.
    if live_epoch != warrant.cached_at_epoch:
        raise StaleAttestationWarrantError(
            f"peer {warrant.peer_id}: execution epoch {live_epoch} != "
            f"warrant epoch {warrant.cached_at_epoch}; forced re-attestation required"
        )

    # Structural signal 2: live measurement diverges from the quote's measurement.
    if live_measurement != warrant.quote.measurement:
        raise StaleAttestationWarrantError(
            f"peer {warrant.peer_id}: live measurement {live_measurement} != "
            f"quoted measurement {warrant.quote.measurement}; capability drift"
        )

    # Structural signal 3: no live nonce challenge answered by the current enclave.
    if live_nonce_response is None or live_nonce_response != expected_nonce:
        raise StaleAttestationWarrantError(
            f"peer {warrant.peer_id}: warrant not bound to current execution instance "
            f"(nonce challenge unanswered)"
        )

    return True


def admit_with_auditor_consensus(
    planner_warrant: CapabilityWarrant,
    auditor_warrant: CapabilityWarrant,
) -> bool:
    if planner_warrant.quote.issued_epoch != auditor_warrant.quote.issued_epoch:
        # Conflicting attestation epochs: refuse, do not resolve by recency.
        raise StaleAttestationWarrantError(
            f"peer {planner_warrant.peer_id}: planner epoch "
            f"{planner_warrant.quote.issued_epoch} != auditor epoch "
            f"{auditor_warrant.quote.issued_epoch}; deadlock, force re-handshake"
        )
    return True