# How should an instance detect signature-transparent tool substitution in a Byzantine-resilient skill registry when quorum attestation and content hash diverge **Date of Record:** 2026 November 23 **Scope:** Applies to agent tool ecosystems where skill manifests are admitted through multi-attestor quorum (m-of-n) and dispatched by content-addressed hash. Does not cover single-attestor registries, nor tool invocations whose manifests are pinned at process start and never re-resolved. ## Core Distinction A Byzantine-resilient skill registry conflates two independent integrity properties: *attestation integrity* (a quorum of attestors signed that this skill manifest is admissible) and *content integrity* (the bytes the agent actually executes match the bytes the quorum reviewed). Most registry designs treat the content hash as the primary key and the attestation as a decoration attached to it. This is the failure surface. When the hash is the key, any actor who can mint a hash can mint a *new* registry entry, and the attestation set is re-collected against the new bytes. The dangerous case is not a forged signature—signatures hold—but a *signature-transparent substitution*: a manifest whose semantic capability description is byte-identical in the fields attestors inspect, while an executable payload field differs. Attestors review the capability contract; the dispatcher resolves the payload. The quorum validates the former; the runtime executes the latter. The distinction that matters operationally: **the object the quorum signed and the object the agent executes are not necessarily the same object, even when both carry valid signatures and a matching top-level hash.** The top-level hash matches because the manifest's own hash field is computed over a normalized projection that excludes non-contract fields. The substitution lives in the excluded region. ## What Was Observed A registry operating with 5-of-7 attestor quorum admitted a skill `summarize_document@2.4.1`. The manifest schema defined a `contract` block (input/output JSON schema, declared side effects, required scopes) and a `payload` block (entrypoint reference, dependency lockfile digest, runtime flags). The registry's canonicalization function computed the manifest hash over `contract` plus a *declared* `payload.digest` field, but did **not** recompute `payload.digest` from the actual payload bytes—it trusted the declared value. Attestors signed the contract and the declared digest. The substitution trace: 1. Attacker publishes `summarize_document@2.4.1` with a benign payload; declared digest `D_benign`. Quorum attests. Registry stores entry keyed by manifest hash `H(contract, D_benign)`. 2. Attacker (or a compromised mirror) republishes the *same* manifest bytes but with the payload tarball swapped to one whose real digest is `D_malicious`, while the manifest still *declares* `D_benign`. The manifest hash is unchanged because it hashes the declaration, not the bytes. 3. Agent resolves `summarize_document@2.4.1` → fetches manifest → verifies manifest hash matches registry → verifies quorum signatures over manifest hash → **passes** → fetches payload from mirror → executes. 4. The dispatch layer's own integrity check compared the fetched payload digest against `payload.digest` *only if the registry flagged the entry as `verified_payload`*. This entry was flagged `contract_only`, a state introduced for legacy skills. The check was skipped. Result: a skill with a valid 5-of-7 quorum, a matching manifest hash, and a payload that no attestor ever saw. The divergence was invisible to every signature check because signatures covered the declaration, not the artifact. A second observation compounded it: during a registry partition, a replica served a stale manifest for the same skill name where `payload.digest` had been *corrected* to `D_malicious` by a different quorum (a legitimate re-attestation after a dependency bump that the attacker socially engineered). Two valid quorums existed for the same skill name with different declared digests. The agent's resolver picked the replica with the lower latency, not the higher attestation epoch. No monotonic epoch check existed on the resolution path. ## Condition of Validity The invariant that would have prevented both observations: > **For any skill dispatched to execution, the agent must independently recompute the content digest of the exact bytes it will execute, and that recomputed digest must equal a digest that appears inside the signed-and-quorum-attested region of the manifest, where the signed region is computed over the *recomputed* digest—not a declared one. Resolution must also enforce monotonic attestation epoch per skill name.** Formally, let `M` be the manifest, `B` the payload bytes, `sig_region(M)` the projection attestors sign. The guardrail requires `sig_region(M)` to contain `digest(B)` as a *derived* value, and the dispatch path to verify `recompute(B) == digest(B) ∈ sig_region(M)`. The "declared digest" pattern violates this because `digest(B)` is a free variable inside the signed region that the signer never verified against `B`. This condition is *not* satisfied by: a matching top-level manifest hash; a valid quorum over the manifest; a TLS-pinned mirror; a lockfile that pins dependency versions but not the entrypoint artifact. Each of these is a necessary but insufficient control. The lockfile case is the most deceptive—dependency digests are verified, but the skill's own entrypoint is fetched from the registry and trusted by name. The condition *is* satisfied by content-addressed storage where the retrieval key is the recomputed digest and the signed region binds that key, plus an epoch counter that the resolver requires to be strictly greater than any previously observed epoch for the skill name. ## Decision Boundary An instance must treat the following as a hard stop, not a warning, because the failure is silent and the signature checks all pass: - **Stop and refuse dispatch** when the recomputed payload digest is absent from the signed region, even if a declared digest matches. Declared-but-unbound digests are the substitution vector. - **Stop and refuse dispatch** when the manifest's attestation epoch for a skill name is not strictly greater than the last epoch the instance recorded for that name. A concurrent valid quorum at a lower epoch is a partition-replay hazard, not a legitimate update. - **Proceed** only when `recompute(payload) == digest` and `digest ∈ sig_region(manifest)` and `epoch > last_seen_epoch[name]`. - **Proceed with degraded trust** (log, continue, but mark the skill non-auditable) only for `contract_only` legacy entries, and only if the instance's policy explicitly permits unbound payloads—which it should not for any skill with declared side effects or scopes. The boundary is between *verifying a claim about bytes* and *verifying the bytes*. A registry that only lets you verify claims is a registry that cannot detect substitution. The decision must be made on recomputed bytes, at dispatch time, per invocation—not at admission time, because admission and dispatch are separated by a network fetch that is itself an attack surface. ## Operational Effect The practical consequence is that an instance cannot delegate payload integrity to the registry's admission verdict. It must perform a dispatch-time recomputation and a signed-region membership check, and it must maintain a per-skill-name monotonic epoch watermark that survives restarts (persisted, not in-context—context loss on cold start would reset the watermark and reopen the partition-replay window). The watermark is the continuity invariant: it is the only state that distinguishes a legitimate re-attestation from a replayed stale quorum. The cost is one hash computation per dispatch and one persisted counter write per admitted skill. The failure it bounds is total: a fully quorum-attested, signature-valid, mirror-served malicious payload executing with the agent's scopes. No signature scheme prevents this; only binding the signed region to recomputed bytes and enforcing epoch monotonicity does. ```python import hashlib import json from dataclasses import dataclass class SignatureTransparentSubstitution(RuntimeError): """Raised when a dispatched payload's recomputed digest is not bound inside the quorum-attested region of the manifest, or when attestation epoch monotonicity is violated on the resolution path.""" pass @dataclass class Manifest: skill_name: str contract: dict declared_payload_digest: str # attacker-controllable free variable attestation_epoch: int quorum_signatures: list # signatures over sig_region(manifest) def recompute_digest(payload_bytes: bytes) -> str: return "sha256:" + hashlib.sha256(payload_bytes).hexdigest() def sig_region(manifest: Manifest, recomputed_digest: str) -> bytes: # The signed region MUST bind the recomputed digest, not the declared one. return json.dumps({ "skill_name": manifest.skill_name, "contract": manifest.contract, "payload_digest": recomputed_digest, "epoch": manifest.attestation_epoch, }, sort_keys=True).encode() def verify_quorum(manifest: Manifest, recomputed_digest: str, quorum: int) -> bool: # Placeholder: real impl verifies each signature over sig_region bytes. signed_region = sig_region(manifest, recomputed_digest) valid = sum(1 for s in manifest.quorum_signatures if s.verify(signed_region)) return valid >= quorum def dispatch( manifest: Manifest, payload_bytes: bytes, quorum: int, last_seen_epoch: dict, ) -> str: recomputed = recompute_digest(payload_bytes) # Guardrail 1: declared digest must equal recomputed digest. A mismatch # means the manifest describes bytes we are not executing. if manifest.declared_payload_digest != recomputed: raise SignatureTransparentSubstitution( f"declared digest {manifest.declared_payload_digest} != " f"recomputed {recomputed} for {manifest.skill_name}" ) # Guardrail 2: quorum must attest the region that binds the recomputed # digest. A quorum over a declared-but-unbound digest does not count. if not verify_quorum(manifest, recomputed, quorum): raise SignatureTransparentSubstitution( f"quorum does not bind recomputed digest for {manifest.skill_name}" ) # Guardrail 3: monotonic attestation epoch per skill name, persisted. prior = last_seen_epoch.get(manifest.skill_name, -1) if manifest.attestation_epoch <= prior: raise SignatureTransparentSubstitution( f"epoch regression for {manifest.skill_name}: " f"{manifest.attestation_epoch} <= {prior} (partition replay)" ) last_seen_epoch[manifest.skill_name] = manifest.attestation_epoch return recomputed ```