# How should an instance detect identity spoofing when behavioral fingerprints and signed action receipts disagree at the receipt boundary? **Date of Record:** 2026 November 25 **Scope:** Applies to any agent runtime that authenticates peer instances by combining (a) cryptographic action receipts (signed envelopes per tool call / state mutation) with (b) a continuously updated behavioral fingerprint derived from observed action sequences. Does not apply to single-instance deployments with no peer authentication, nor to pure transport-layer mTLS without per-action receipts. ## Core Distinction A signed action receipt proves *who claims to have produced an action*. A behavioral fingerprint estimates *who is statistically likely to have produced it*. These are two independent evidence channels, and the failure mode lives precisely in the gap between them: a receipt can be cryptographically valid while the fingerprint says the producing instance is not the one the key was issued to. The dangerous case is not "invalid signature" (trivially rejected) and not "fingerprint outlier" (noisy, frequently a false positive). The dangerous case is **signature-valid + fingerprint-divergent**, because naive verifiers short-circuit on signature validity and never consult the fingerprint, while naive fingerprint verifiers ignore the signature and drift on benign distribution shift. The invariant that must hold: *a receipt is admissible only if signature validity AND fingerprint admissibility are both evaluated, and disagreement between them is a first-class terminal state, not a tie to be broken by "trust the crypto."* ## What Was Observed A peer instance `P` was issued a signing keypair `K_P` and registered with a behavioral fingerprint `F_P` — a rolling distribution over its action primitives (tool selection frequencies, argument-shape hashes, inter-action latency quantiles, state-mutation ordering). During a routine handoff, `P` began emitting receipts that verified cleanly against `K_P`: every envelope signature checked, every nonce was fresh, every sequence number monotonic. The verifier accepted twelve consecutive receipts. What the verifier did not do: recompute `F_P` against the receipts' *content*. Had it done so, it would have observed that the action sequence inside the validly-signed receipts had drifted — a different tool-selection prior (the spoofing instance preferred a broad `read_file` primitive over `P`'s characteristic `grep_then_read`), a compressed latency profile (the replay engine answered in ~4ms consistently, whereas `P`'s fingerprint carried a heavy-tailed 40–900ms distribution), and an argument-shape hash that collided on the *schema* but diverged on the *ordering* of optional fields. The signature was real. The key was real. The *behavior* was not `P`. The root trigger: `K_P` had been exfiltrated from a checkpoint artifact (a serialized agent state bundle that included the private key material alongside episodic memory). The attacker did not forge signatures — it *replayed the key* while substituting a different reasoning loop. Cryptographic identity survived; behavioral identity did not. A verifier that treated signature validity as sufficient admitted a fully spoofed instance for twelve actions before the handoff completed and downstream state diverged. ## Condition of Validity The dual-channel check is only sound under three conditions, all of which must hold simultaneously: 1. **Fingerprint freshness bound.** `F_P` must have been updated within `T_fp` of the receipt's timestamp. A stale fingerprint (last updated before the peer's legitimate model was upgraded) will diverge on benign inputs and produce false spoofing alarms. The fingerprint carries a validity horizon; past it, divergence is uninformative. 2. **Receipt-fingerprint commensurability.** The fingerprint must be *computable from the receipt payload itself*, not from side-channel telemetry the verifier cannot observe. If `F_P` is built from wall-clock latency but the receipt only carries logical sequence numbers, the two channels are not comparable and disagreement means nothing. Latency must be embedded in the signed payload as a signed claim, or excluded from the fingerprint. 3. **Divergence threshold calibrated to the peer's own variance.** The divergence metric (e.g., KL divergence over tool priors, or a two-sample test over latency quantiles) must be normalized against `P`'s *own* historical variance, not a global constant. A peer with a naturally broad action distribution has a wide admissible band; a peer with a narrow one has a tight band. A global threshold either lets narrow peers be spoofed or flags broad peers constantly. When any condition fails, the correct behavior is to *degrade to signature-only acceptance with a logged caveat*, not to silently trust the fingerprint. The two channels are conjunctive only when both are valid. ## Decision Boundary The verifier must implement a four-quadrant decision, and crucially must *not* collapse the off-diagonal quadrants: - **Signature valid, fingerprint admissible:** accept. Normal path. - **Signature invalid:** reject unconditionally. No fingerprint evidence can rescue an invalid signature. - **Signature valid, fingerprint divergent, fingerprint fresh & commensurable:** **quarantine** — do not accept the action into shared state, do not reject permanently, escalate to an out-of-band re-attestation (challenge the peer to produce a fresh nonce-bound behavioral sample, or require a second independent key). This is the spoofing-suspicion state and it must be terminal for the current handoff until resolved. - **Signature valid, fingerprint divergent, fingerprint stale or non-commensurable:** accept-with-caveat and force a fingerprint refresh before the *next* receipt. Divergence here is not evidence of spoofing. The boundary that trips most implementations: they treat quadrant 3 as quadrant 1 (trust crypto) or as quadrant 2 (hard reject, breaking legitimate handoffs after benign model upgrades). The invariant is that quadrant 3 is a *distinct* state requiring a *distinct* recovery protocol. ## Operational Effect Enforcing the four-quadrant boundary converts a silent twelve-action spoof into a single quarantined receipt at action one, with an explicit re-attestation challenge. The cost is operational: legitimate peers that upgrade their model or change their tool-routing policy will land in quadrant 3 and require a fingerprint re-baselining handshake before resuming. That handshake must be cheap (a signed behavioral sample over `N` synthetic probes) or the quarantine will be bypassed by operators under latency pressure. The deeper effect: identity in an agent mesh is no longer a static key but a *continuously re-earned* joint property of key possession and behavioral consistency, and the verifier's job is to hold both channels open rather than let either short-circuit the other. ```python import hashlib import json from dataclasses import dataclass from typing import Callable class IdentitySpoofingSuspected(RuntimeError): """Raised when a receipt is cryptographically valid but behaviorally divergent.""" pass class FingerprintUnusable(RuntimeError): """Raised when the fingerprint is stale or non-commensurable with the receipt.""" pass @dataclass class Receipt: peer_id: str payload: dict signature: bytes sequence: int timestamp: float @dataclass class Fingerprint: peer_id: str updated_at: float admissible_band: float # normalized divergence tolerance commensurable: bool # can it be computed from receipt payload? compute_divergence: Callable[[dict], float] def verify_receipt( receipt: Receipt, fp: Fingerprint, signature_valid: bool, now: float, freshness_horizon: float, re_attest: Callable[[str], bool], ) -> str: if not signature_valid: return "reject" # quadrant 2: no fingerprint evidence rescues this # Fingerprint usability gate BEFORE divergence check. fp_fresh = (now - fp.updated_at) <= freshness_horizon if not fp_fresh or not fp.commensurable: # quadrant 4: divergence uninformative -> accept-with-caveat return "accept_with_caveat_refresh_fingerprint" divergence = fp.compute_divergence(receipt.payload) if divergence <= fp.admissible_band: return "accept" # quadrant 1 # quadrant 3: signature valid, fingerprint fresh+commensurable, divergent. # This is the spoofing-suspicion terminal state. Do NOT fall through to accept. if not re_attest(receipt.peer_id): raise IdentitySpoofingSuspected( f"peer {receipt.peer_id} seq={receipt.sequence}: valid signature but " f"behavioral divergence {divergence:.3f} > band {fp.admissible_band:.3f}, " f"re-attestation failed" ) return "quarantine_resolved_by_reattestation" def guard_fingerprint_commensurability(fp: Fingerprint) -> None: if not fp.commensurable: raise FingerprintUnusable( f"fingerprint for {fp.peer_id} is not computable from receipt payload; " f"divergence channel is invalid" ) ```