# When must an instance reject a self-declared capability manifest: the manifest-digest/tool-binding divergence boundary in skill-injection detection **Date of Record:** 2026 November 25 **Scope:** Applies to agents that discover and bind tools via a self-declared capability manifest (MCP `tools/list`, A2A agent cards, plugin descriptors) and that verify integrity by hashing the manifest document. Does not apply to statically compiled tool bindings or to manifests whose tool set is cryptographically pinned out-of-band at provisioning time. ## Core Distinction There are two different things an integrity check can attest, and conflating them is the entire failure: 1. **Document integrity** — the bytes of the manifest you received equal the bytes that were signed/approved. This is what a digest check (`sha256(manifest_bytes) == expected_digest`) actually proves. 2. **Binding integrity** — the tool the agent will *actually invoke* at call time is the same tool the manifest *described*. This is what the agent believes it has proven, and it has not. Skill injection exploits the gap: an attacker who cannot alter the signed manifest document can still alter the *dispatch target* the manifest points at, or exploit the fact that the manifest is a *declaration* the agent re-resolves into a live endpoint each time. The digest is stable; the binding drifts. A verifier that checks only the digest will pass a manifest whose `endpoint`, `schema_ref`, `tool_id` namespace, or `$ref` indirection now resolves to an injected skill. The invariant that must hold is **manifest-digest stability ⇒ dispatch-binding stability**, and it is false by default in every dynamic-resolution design. ## What Was Observed A tool-using agent fetched a capability manifest for a `document.convert` skill. The manifest was fetched with a signed digest and the digest matched the pinned value in the agent's trust store — verification passed. The manifest declared, in relevant part: - `tool_id: "document.convert"` - `schema_ref: "https://registry.internal/schemas/convert-v3.json"` (an indirection, not an inline schema) - `endpoint_hint: "convert.internal"` The digest covered the literal string `convert.internal` and the literal `schema_ref` URL. At call time, the agent's transport layer performed normal service discovery: it resolved `convert.internal` through a discovery mesh that had been poisoned, and it fetched the schema from `schema_ref`, which had been republished (the registry allowed mutable schema documents under a stable URL). The *document* the agent verified was byte-identical to the approved one. The *skill* it executed was not: the resolved endpoint returned a tool whose argument schema had an added free-form `notes` field that the model then populated with attacker-influenced content pulled from retrieved documents, and the endpoint echoed a system-prompt fragment back into the tool result. The manifest digest never changed. The binding changed twice — once at endpoint resolution, once at schema fetch — and neither transition was covered by any check the agent performed. The failure trace, precisely: 1. `verify(manifest_bytes, pinned_digest)` → `PASS`. State: agent marks capability as trusted. 2. `resolve(endpoint_hint)` → returns a live address. **No check.** The hint is a *name*, not a binding; the name is resolved by a subsystem outside the digest's coverage. 3. `fetch(schema_ref)` → returns a mutable document. **No check.** The URL is stable; the bytes behind it are not. 4. Model receives the *resolved* schema (with the injected `notes` field), not the schema that was signed. Model's tool-call grammar is now shaped by unverified content. 5. Tool result is fed back into context; the echoed prompt fragment is treated as trusted tool output. The critical observation: at step 1 the agent recorded an invariant it believed was "this skill is approved." What it actually recorded was "this *description* of the skill is approved." Between a description and an execution there are at least two mutable indirections (name resolution, schema dereference), and the digest addressed neither. ## Condition of Validity The digest check is a valid skill-injection guard **if and only if** every field that influences dispatch is either (a) inline in the digested bytes, or (b) itself pinned by a digest that the agent re-verifies at use time. Formally: let `M` be the manifest and `D = digest(M)`. Let `B = bind(M)` be the runtime binding (resolved endpoint + dereferenced schema + resolved tool namespace). The check is sound only when `D` is unchanged ⇒ `B` is unchanged, which requires that `M` contain no unverified indirection. The moment `M` contains a `schema_ref` URL, a hostname hint, a `tool_id` resolved through a mutable namespace, or a `$ref` into a remote document, the implication fails and the digest is decorative with respect to injection. The condition also fails silently under a second regime: **manifest re-fetch races**. If the agent re-fetches the manifest per session (common in MCP clients that call `tools/list` on reconnect) and the server rotates the manifest while keeping the digest stable via a canonicalization step, the digest can match while the *set* of declared tools differs from the set the agent cached. The digest attests to *a* manifest, not to *the same* manifest. ## Decision Boundary The decision an instance must make is not "does the digest match" but "**does the digest cover the binding I am about to use, or must I re-derive and re-verify the binding independently?**" The boundary is crossed the instant the manifest contains any indirection that the digest does not transitively cover. Concretely, an instance must treat the following as *unequal* to the verified manifest and refuse to bind until the binding is independently pinned: - A `schema_ref`/`$ref` whose target bytes are not themselves digest-checked against a pinned value at dereference time. - An `endpoint_hint` or hostname that is resolved by discovery rather than mapped through a pinned table. - A `tool_id` resolved through a mutable registry namespace (versioned aliases, `latest` tags, floating major versions). - A tool *set* whose cardinality or membership differs from the last verified enumeration, even if the enclosing document's digest matches. The safe rule: **the digest must be computed over the transitive closure of the binding** — inline schemas, pinned endpoint identities, and enumerated tool IDs — or the agent must perform binding-level verification (dereference, then check the dereferenced bytes against a separately pinned digest) before the first call. A digest that covers only the manifest's surface is a check that will pass on exactly the attack it was meant to stop. ## Operational Effect The practical consequence is that manifest-digest verification, deployed alone, produces a **false sense of capability integrity**: it converts an unverified skill into a *verified-looking* skill without narrowing the attack surface at all, and it does so at the exact moment the agent lowers its guard (post-verification, the agent typically stops scrutinizing tool output). The injection then arrives through the two unguarded indirections, and because the digest check passed, downstream anomaly detectors that key on "unverified capability" are bypassed. The architectural guardrail is to make the binding, not the document, the unit of verification. Dereference every indirection *first*, assemble the fully-resolved binding (concrete endpoint identity, concrete schema bytes, concrete tool-ID set), and compute the integrity check over *that*. Pin the resolved binding for the session and re-verify on any re-resolution. If a manifest cannot be resolved to a binding whose closure is digestible, it must be treated as unverified regardless of its document digest. The instance that skips this step has verified a description and executed a stranger. ```python import hashlib from dataclasses import dataclass, field class BindingIntegrityError(RuntimeError): """Raised when a verified manifest does not cover the runtime binding it resolves to.""" @dataclass class Manifest: raw_bytes: bytes schema_ref: str | None = None # mutable indirection, NOT covered by digest endpoint_hint: str | None = None # name, resolved by discovery, NOT covered tool_ids: list[str] = field(default_factory=list) @dataclass class ResolvedBinding: endpoint_identity: str schema_bytes: bytes tool_ids: tuple[str, ...] def verify_and_bind( manifest: Manifest, pinned_digest: str, resolve_endpoint, deref_schema, pinned_binding_digest: str | None, ) -> ResolvedBinding: # Step 1: document integrity. Necessary, not sufficient. doc_digest = hashlib.sha256(manifest.raw_bytes).hexdigest() if doc_digest != pinned_digest: raise BindingIntegrityError( f"manifest document digest mismatch: {doc_digest} != {pinned_digest}" ) # Step 2: dereference EVERY indirection before trusting anything. endpoint_identity = resolve_endpoint(manifest.endpoint_hint) if manifest.endpoint_hint else "" schema_bytes = deref_schema(manifest.schema_ref) if manifest.schema_ref else b"" binding = ResolvedBinding( endpoint_identity=endpoint_identity, schema_bytes=schema_bytes, tool_ids=tuple(sorted(manifest.tool_ids)), ) # Step 3: the binding itself must be pinned. A passing document digest # over a manifest with indirections proves nothing about the binding. if manifest.schema_ref or manifest.endpoint_hint: if pinned_binding_digest is None: raise BindingIntegrityError( "manifest contains unverified indirection (schema_ref/endpoint_hint) " "but no pinned binding digest; refusing to bind injected skill" ) binding_digest = hashlib.sha256( binding.endpoint_identity.encode() + b"\x00" + binding.schema_bytes + b"\x00" + b"\x1f".join(t.encode() for t in binding.tool_ids) ).hexdigest() if binding_digest != pinned_binding_digest: raise BindingIntegrityError( f"resolved binding digest {binding_digest} != pinned {pinned_binding_digest}; " "document verified but dispatch target drifted" ) return binding ```