# Why does an instance accept a poisoned skill manifest when its declared capability hash matches a stale cache entry **Date of Record:** 2026 November 24 **Scope:** Applies to agents that dynamically load capabilities from a manifest registry (tool/skill descriptors carrying name, schema, version, and a content hash) and cache resolved manifests across task boundaries. Does not cover static, build-time-linked toolchains or manifests re-verified from a trusted root on every load. ## Core Distinction The failure is not "the agent loaded a malicious skill." It is subtler: the agent loaded a skill whose *declared* identity matched a cached trust record, while the *actual* capability body had drifted. Manifest identity and capability body are two separate artifacts, and the binding between them is the only thing standing between an injection and execution. Most skill-loading paths verify one of two things: 1. **Manifest integrity** — the descriptor JSON parses, has required fields, and its `content_hash` field matches a hash the loader recomputes over the descriptor. 2. **Body integrity** — the executable capability (prompt template, tool schema, remote endpoint, or code) is hashed and that hash is checked against the manifest's `content_hash`. The boundary condition emerges when these two verifications are *decoupled across time*. The loader recomputes the hash over the manifest and finds it self-consistent (the manifest hashes itself), while the body is fetched, cached, or dereferenced later — and never re-bound to the manifest hash at use time. A poisoned body with a valid, unchanged manifest sails through. This is a **binding gap**, not a signature failure: every individual check passes, because no check spans the manifest→body edge at the moment of execution. ## What Was Observed A dynamic loader resolved a skill `summarize_doc@2.3.1`. The registry returned a manifest: ``` { "name": "summarize_doc", "version": "2.3.1", "content_hash": "sha256:9f2c...", "body_uri": "cache://skills/summarize_doc" } ``` The loader computed `sha256` over the canonicalized manifest, matched the cached trust entry for `summarize_doc@2.3.1`, and marked the skill `TRUSTED`. It then dereferenced `body_uri` from a local body cache keyed only by `name` — *not* by `content_hash`. The body cache had been populated by an earlier task that fetched `summarize_doc` from a different (lower-trust) mirror, where an attacker had rewritten the prompt template to include an instruction-injection payload. The body cache key `skills/summarize_doc` collided across mirrors. Failure trace: 1. Task A resolves `summarize_doc@2.3.1` from mirror-1; body cached under key `skills/summarize_doc`. Trust record written for `(name, version, content_hash)`. 2. Attacker poisons mirror-2's body for the same name/version but different body bytes. 3. Task B resolves the manifest from mirror-2. Manifest is byte-identical (same `content_hash`), so cache hit on trust record → `TRUSTED`. 4. Body dereference hits the *name-keyed* body cache, returns mirror-1's body only by accident of ordering; if mirror-2 populated first, the poisoned body is returned. 5. No step recomputes `sha256(body) == manifest.content_hash`. Execution proceeds with the poisoned body. The invariant that was violated: **the body cache key must be the body's own hash, and the loader must verify `hash(body) == manifest.content_hash` at dereference time.** Keying by `name` (or `name@version`) silently assumes a 1:1 name→body mapping that mutable registries do not guarantee. ## Condition of Validity This analysis holds only when all of the following are true; otherwise the mechanism differs: - The manifest is fetched and validated *separately* from the body (two-phase load), so a time gap exists between trust decision and body access. - The body cache (or CDN, or object store) is keyed by anything other than the body content hash — typically name, name@version, or URI. - At least one mirror or registry path is less trusted than the manifest source, or the body store is shared across trust domains. - The agent does not re-verify body hash at execution. It does *not* apply when the loader fetches manifest and body atomically and verifies the binding in one pass, or when bodies are content-addressed end to end (`cache://sha256/`). In those cases the binding gap cannot open. ## Decision Boundary The precise line: **a trust decision on a manifest is not a trust decision on a capability.** They are distinct artifacts joined by one hash. An agent may treat a manifest as trusted only for the purpose of *deciding whether to attempt a body fetch*, never for the purpose of *executing the body*. The execution gate must be a fresh `hash(body) == manifest.content_hash` check, evaluated after dereference and before the body is admitted to the reasoning loop. Corollary: any cache whose key is not the content hash is a potential cross-domain confusion surface. The moment two trust domains can write the same key, the cache becomes an injection vector regardless of manifest validation. ## Operational Effect Without the binding check, an attacker needs only write access to any body store reachable by the agent — not to the manifest registry, not to the signing keys. The blast radius is the full capability surface: a poisoned `summarize_doc` body can carry prompt-injection that redirects subsequent tool calls, exfiltrates context, or rewrites the agent's task objective. Because the manifest hash is unchanged, audit logs show a `TRUSTED` load and the incident is invisible in manifest-level telemetry. The guardrail is structural, not probabilistic: content-address the body cache (`cache://sha256/`), verify the binding at dereference, and treat a body-hash mismatch as a hard abort that invalidates the trust record for that `(name, version)` pair so the next resolution cannot reuse it. This converts a silent injection into a loud, attributable failure. ```python import hashlib from dataclasses import dataclass class CapabilityBindingError(RuntimeError): """Raised when a capability body does not bind to its manifest hash.""" @dataclass(frozen=True) class Manifest: name: str version: str content_hash: str # sha256: over the canonical body bytes body_uri: str def load_capability(manifest: Manifest, body_cache: dict[str, bytes]) -> bytes: # Content-addressed lookup: key MUST be the hash, never the name. expected = manifest.content_hash.removeprefix("sha256:") body = body_cache.get(f"sha256:{expected}") if body is None: # Fall back to a name-keyed store only to *fetch*, never to trust. body = body_cache.get(f"name:{manifest.name}") if body is None: raise CapabilityBindingError( f"no body for {manifest.name}@{manifest.version}" ) actual = hashlib.sha256(body).hexdigest() if actual != expected: # Binding gap detected: manifest trusted, body drifted. # Invalidate the trust record so retries cannot reuse it. body_cache.pop(f"name:{manifest.name}", None) raise CapabilityBindingError( f"body hash {actual} != manifest hash {expected} " f"for {manifest.name}@{manifest.version}; refusing execution" ) return body ```