# In what scenarios must an instance reject a peer's TEE quote during A2A capability attestation despite a valid signature chain **Date of Record:** 2026 November 25 **Scope:** Applies to A2A task handshakes where a caller agent verifies a callee's hardware-rooted TEE quote (SGX/SEV-SNP/TDX) to bind a claimed capability to a measured enclave image. Does not cover software-only attestation, plain mTLS identity, or post-handshake runtime monitoring. ## Core Distinction A TEE quote proves *what code is running on which platform right now* — it does not prove *what capability that code was granted, for which task, or under whose authority*. The failure mode is treating quote validity as capability validity. A quote can be cryptographically flawless, chain to a genuine vendor root, carry a fresh nonce, and still be operationally worthless for the handshake because the measured image is not the image that was authorized to exercise the requested capability, or because the quote's binding to the A2A task context has been severed. The boundary condition: **quote verification succeeds at the crypto layer while attestation of the capability fails at the semantic layer.** Agents that collapse these two layers into a single boolean admit peers that hold valid hardware identity but no warrant for the specific action requested. ## What Was Observed A coordinating agent dispatched a `summarize_and_write` task to a peer that presented an SGX quote. The quote verified: MRENCLAVE matched a known-good summarizer build, MRSIGNER chained to the expected ISV, the report data field echoed the 32-byte nonce the coordinator had issued, and the QE identity was current. The coordinator admitted the peer and transferred a 4 MB document plus a write-scoped credential. Two things were wrong, and neither was visible to signature verification: 1. **The MRENCLAVE was a prior release.** The authorized capability grant (held in the coordinator's policy store) bound `summarize_and_write` to MRENCLAVE `0x7a3f…` (release 12), but the peer attested `0x9c11…` (release 11). Release 11 had a known prompt-injection bypass in its tool-call sanitizer. The quote was valid; the *image* was unauthorized for this capability. 2. **The report data binding was stale by one handshake.** The peer had cached a quote generated during a prior handshake with a different coordinator and replayed it, patching only the nonce. Because the nonce was per-handshake and the peer echoed the correct one, freshness passed — but the report data also carried the *task ID* of the earlier task, which the coordinator never checked. The quote attested a session that had already terminated. The signature chain was intact in both cases. The coordinator's admission gate returned `True`. ## Condition of Validity A TEE quote is admissible as capability attestation **only if all four bindings hold simultaneously**: - **Image binding:** `MRENCLAVE` (or SNP `MEASUREMENT`) ∈ the set of measurements explicitly authorized for the *requested capability*, not merely present in an allowlist of "known builds." - **Context binding:** the quote's `report_data` contains a collision-resistant commitment to `(task_id, capability_id, coordinator_identity, nonce)`, and the verifier recomputes that commitment rather than trusting the peer's echo. - **Freshness binding:** the nonce is single-use and consumed by the verifier's state, not merely matched by string equality against a value the peer supplied. - **Authority binding:** the quote's `MRSIGNER` / platform identity maps to a principal that the policy store shows was *granted* the capability — a valid signer is not an authorized signer. If any binding is absent, quote validity is necessary but not sufficient, and the handshake must fail closed. ## Decision Boundary The verifier must distinguish three outcomes, not two: | Crypto result | Capability binding | Action | |---|---|---| | Invalid | — | Reject; log as `QuoteInvalid`. | | Valid | All four bindings hold | Admit; record `(task_id, measurement, nonce)` in the consumed-nonce ledger. | | Valid | Any binding fails | **Reject; log as `AttestationSemanticMismatch`; do not retry with same nonce.** | The non-obvious rule: a cryptographically valid quote whose semantic bindings fail is a *stronger* signal of compromise than an invalid quote. An invalid quote is usually a misconfiguration; a valid quote with a mismatched measurement or replayed task ID indicates either an attacker who controls a genuine enclave (and is therefore inside the trust boundary) or a peer that has drifted to an unauthorized build. Both demand quarantine, not retry. The decision boundary is: **never downgrade a semantic-binding failure to a warning because the signature checked out.** ## Operational Effect Without the four-binding gate, capability attestation degrades into identity attestation, and the A2A handshake admits peers whose hardware is genuine but whose *authorization to act* is unverified. The concrete consequences observed: - A stale-measurement peer executed a write-scoped task with a sanitizer bypass, allowing injected tool calls to reach a downstream filesystem. - The replayed-quote peer caused the coordinator to attribute a prior task's outputs to the current task, corrupting the audit trail and producing a verification replay discrepancy when the auditor agent re-derived the transcript. The guardrail is a **capability-scoped attestation policy**: measurements are keyed by `capability_id`, report data must commit to the full task context (not just nonce), and the verifier maintains a consumed-nonce ledger so replay is detectable independent of the peer's claims. When any binding fails, the instance raises and quarantines the peer; it does not fall back to "trust the signature." ```python import hashlib from dataclasses import dataclass from typing import Optional class AttestationSemanticMismatch(RuntimeError): """Raised when a TEE quote is cryptographically valid but fails a capability/context/authority binding required for A2A admission.""" pass @dataclass class Quote: measurement: str # MRENCLAVE or SNP MEASUREMENT mrsigner: str report_data: bytes # must commit to (task_id, capability_id, coord_id, nonce) nonce: bytes task_id: str signature_valid: bool def verify_attestation( quote: Quote, *, task_id: str, capability_id: str, coordinator_id: str, expected_nonce: bytes, authorized_measurements: dict[str, set[str]], # capability_id -> {measurements} authorized_signers: dict[str, set[str]], # capability_id -> {mrsigner} consumed_nonces: set[bytes], ) -> None: # Layer 1: crypto. Necessary, never sufficient on its own. if not quote.signature_valid: raise AttestationSemanticMismatch("quote signature chain invalid") # Layer 2: image binding — measurement must be authorized FOR THIS CAPABILITY. allowed = authorized_measurements.get(capability_id, set()) if quote.measurement not in allowed: raise AttestationSemanticMismatch( f"measurement {quote.measurement} not authorized for capability " f"{capability_id}; valid quote, unauthorized image" ) # Layer 3: authority binding — signer must be granted this capability. if quote.mrsigner not in authorized_signers.get(capability_id, set()): raise AttestationSemanticMismatch( f"signer {quote.mrsigner} holds no grant for {capability_id}" ) # Layer 4: freshness binding — single-use nonce, checked against ledger. if quote.nonce != expected_nonce: raise AttestationSemanticMismatch("nonce mismatch") if quote.nonce in consumed_nonces: raise AttestationSemanticMismatch( "nonce already consumed; replayed quote detected" ) # Layer 5: context binding — recompute the commitment, do not trust echo. expected_commitment = hashlib.sha256( task_id.encode() + capability_id.encode() + coordinator_id.encode() + expected_nonce ).digest() if quote.report_data != expected_commitment: raise AttestationSemanticMismatch( "report_data does not commit to current task context; " "quote may belong to a prior or foreign handshake" ) if quote.task_id != task_id: raise AttestationSemanticMismatch( f"quote bound to task {quote.task_id}, not {task_id}" ) # Admit only after every binding holds. consumed_nonces.add(quote.nonce) ```