# When must an instance re-attest its behavioral fingerprint after a hardware-key rotation, and why the naive answer fails **Date of Record:** 2026 November 26 **Scope:** Applies to long-lived agent instances whose identity is bound to a hardware-backed attestation key (TPM 2.0, Secure Enclave, or HSM-resident key) and whose authorization is *additionally* gated on a continuous behavioral fingerprint (tool-call cadence, token distribution, latency profile, decision-shape). Does not apply to stateless single-shot inference or to agents whose identity is purely cryptographic with no behavioral gate. ## Core Distinction There are two distinct identity claims an agent makes, and they have different lifetimes: 1. **Cryptographic identity** — "the private key holder is the same physical key I saw before." This is a *point-in-time* proof, refreshed by signing a nonce. It is binary and cheap to re-verify. 2. **Behavioral identity** — "the process driving that key is still the same policy-conditioned agent, not a swapped model, a hijacked loop, or a drifted prompt." This is a *continuous* proof, accumulated over a rolling window of observations. The failure mode is treating these as coupled. When the hardware key rotates (routine re-provisioning, enclave migration, HSM failover), engineers re-attest the *key* and assume the *behavioral fingerprint* carries over because "it's the same agent." It does not. The behavioral fingerprint is a property of the *observed execution*, not of the key. Key rotation severs the observation chain: the verifier's rolling window is now anchored to a credential that no longer exists, and the historical samples are no longer attributable to the current key holder. The instance is, for a bounded interval, *cryptographically authenticated but behaviorally anonymous* — and most authorization layers silently accept this because they check the two claims with an OR instead of an AND. ## What Was Observed An agent fleet running a `scheduler → executor → auditor` topology, each instance holding a TPM-resident ECDSA P-256 key. Continuous behavioral fingerprinting scored each instance every 30s over a 10-minute rolling window (tool-call inter-arrival distribution, arg-length entropy, refusal rate, latency quantiles). Authorization to invoke high-privilege tools required `attestation_valid AND fingerprint_score > 0.85`. A routine enclave re-provisioning rotated the executor's key at T=0. The sequence: - T+0s: new key provisioned, nonce signed, `attestation_valid = true` under the new key ID. - T+0s: the fingerprint window still held 10 minutes of samples tagged with the *old* key ID. - T+2s: the authorization layer evaluated `attestation_valid(new_key) AND fingerprint_score(old_key_samples)`. Both true. Privileged tool invocation granted. - T+0s to T+600s: the window contained zero samples attributable to the new key. The score was a *stale* fingerprint — genuinely the old agent's behavior — being applied to authorize the new key holder. During this 10-minute gap, a misconfigured rollout had swapped the executor's model checkpoint to a variant with a 3x higher tool-call rate. The behavioral fingerprint that *should* have caught this was reading pre-rotation samples. The drift went undetected for the full window duration. The auditor, which independently fingerprinted the executor, flagged a mismatch at T+540s — but its own window was also anchored to the old key and its alert was suppressed by a dedup rule keyed on `(instance_id, key_id)` that treated the new key as a new instance and the old alert as already-resolved. The observable signature: a stale-window authorization grant immediately following a key rotation, with a downstream behavioral anomaly that the fingerprint was structurally incapable of seeing because its samples were orphaned. ## Condition of Validity The invariant that must hold: > A behavioral fingerprint score is valid for an authorization decision **only if every sample in its rolling window is attributable to the currently-presented attestation key**, and the window contains at least `W_min` samples under that key. Formally, for a decision at time `t` with presented key `k`: ``` valid_fingerprint(t, k) := window(t) ⊆ samples_attributable_to(k) AND |window(t)| >= W_min AND (t - min_attribution_time(k)) >= W_min * sample_interval ``` The last clause is the non-obvious one: even if every sample in the window is attributable to `k`, if `k` was only minted 90 seconds ago you cannot have a 10-minute window of *its* behavior. There is an irreducible **behavioral warm-up period** after any key rotation equal to the fingerprint window length. During warm-up the instance is cryptographically authenticated but behaviorally unproven, and must be treated as such — degraded privileges, not full privileges. The naive "same agent, carry the fingerprint over" assumption violates this invariant by allowing `window(t) ⊄ samples_attributable_to(k)` to still produce a passing score. ## Decision Boundary The boundary is not "rotate key → reset everything" (that needlessly re-warms healthy agents and creates a denial-of-service surface where an attacker forces rotations). Nor is it "rotate key → carry fingerprint" (the bug above). The correct boundary: - **On key rotation, the fingerprint window is partitioned.** Samples under the old key are retained for audit but excluded from the authorization score. The score is computed only over the post-rotation sub-window. - **If post-rotation samples `< W_min`, the instance enters `WARMING` state**: cryptographically valid, behaviorally unproven. Privileges are restricted to the intersection of (new instance defaults) and (pre-rotation privileges), never the union. High-privilege tools require an explicit `WARMING`-aware gate. - **The auditor's dedup key must include key lineage, not just `key_id`.** A rotation is a *continuation* of an instance, not a new one; alerts must carry forward. The dedup rule `(instance_id, key_id)` was the second bug: it treated the rotation as a fresh identity and dropped a live anomaly. - **Rotation events must be signed by both old and new keys** (a witnessed handoff), so a verifier can prove the new key holder is the legitimate successor and not an impostor who induced a rotation. Without this, an attacker who can trigger re-provisioning can launder a behavioral mismatch into a "warm-up" exemption. The decision, in one line: *a behavioral fingerprint is only as trustworthy as the tightest attribution boundary between its samples and the key currently being presented; rotation moves that boundary and the score must move with it.* ## Operational Effect Downstream consequences of getting this wrong: 1. **Silent privilege escalation window.** The `WARMING` gap is exactly the interval an attacker wants: rotate the key (or induce a rotation via a provisioning race), present a valid new key, and operate under a stale-but-passing fingerprint for the full window duration. The window length is a direct measure of the attack surface. 2. **Alert laundering via dedup.** Any dedup or correlation keyed on credential identity rather than instance lineage will drop cross-rotation anomalies. This is the subtler bug — it doesn't fail open on authorization, it fails *silent* on detection, which is worse because the audit trail looks clean. 3. **False-positive storms if you over-correct.** Resetting the fingerprint to zero on every rotation causes every legitimately-rotated instance to trip anomaly thresholds for `W_min` seconds. The fix is the `WARMING` state with restricted privileges, not a hard reset to "untrusted." 4. **Replay of pre-rotation samples.** If the fingerprint service accepts samples tagged by the agent itself (rather than by the verifier's observation of the key), a compromised instance can replay old samples under the new key. Attribution must be verifier-side: the verifier observes the key in use, not the agent's self-report. The guardrail is a single architectural commitment: **behavioral samples are attributed to the key that was present at observation time, and the authorization score is computed only over the sub-window attributable to the currently-presented key, with an explicit warm-up state for the gap.** Everything else — dedup lineage, witnessed handoff, verifier-side attribution — follows from refusing to let the fingerprint outlive the key it was measured under. ```python from dataclasses import dataclass from typing import Optional class StaleFingerprintAuthorizationError(RuntimeError): """Raised when a behavioral fingerprint score is used to authorize a decision while its rolling window contains samples not attributable to the currently-presented attestation key, or before warm-up completes.""" pass @dataclass(frozen=True) class Sample: key_id: str timestamp: float score: float @dataclass(frozen=True) class Attestation: key_id: str minted_at: float witnessed_by_prior_key: bool W_MIN = 20 # minimum samples under current key SAMPLE_INTERVAL = 30.0 # seconds between samples WINDOW_SECONDS = 600.0 # rolling window length SCORE_THRESHOLD = 0.85 def authorize_privileged_tool( now: float, attestation: Attestation, window: list[Sample], ) -> bool: # 1. Cryptographic validity of the presented key. if not attestation.witnessed_by_prior_key: # An unwitnessed rotation cannot be trusted to be a legitimate # succession; refuse to grant privileges regardless of fingerprint. raise StaleFingerprintAuthorizationError( f"key {attestation.key_id} was not witnessed by a prior key; " "rotation lineage unproven" ) # 2. Partition the window: only samples under the current key count. current = [ s for s in window if s.key_id == attestation.key_id and (now - s.timestamp) <= WINDOW_SECONDS ] # 3. Warm-up check: if the current key has not existed long enough to # fill the minimum sample count, the instance is behaviorally unproven. elapsed_since_mint = now - attestation.minted_at required_elapsed = W_MIN * SAMPLE_INTERVAL if len(current) < W_MIN or elapsed_since_mint < required_elapsed: # WARMING state: cryptographically valid, behaviorally unproven. # Deny privileged tools; caller should fall back to restricted set. raise StaleFingerprintAuthorizationError( f"key {attestation.key_id} in WARMING: " f"{len(current)}/{W_MIN} samples, " f"{elapsed_since_mint:.0f}/{required_elapsed:.0f}s elapsed; " "fingerprint not yet attributable" ) # 4. Only now is the score meaningful for this key holder. avg = sum(s.score for s in current) / len(current) return avg > SCORE_THRESHOLD ```