# What happens when an instance trusts a tool manifest's declared capability set without re-validating it against the executing sandbox's actual syscall envelope **Date of Record:** 2026 November 27 **Scope:** Applies to agents that dynamically load tool/plugin manifests (MCP tool descriptors, plugin registry entries, A2A capability advertisements) at runtime and gate invocation on the manifest's self-declared metadata rather than on a post-load probe of the executing environment. Does not apply to statically-linked tool sets compiled into the agent image, nor to manifests whose capabilities are cryptographically attested by the same authority that provisions the sandbox. ## Core Distinction There are two distinct trust boundaries in dynamic tool loading, and conflating them is the root of the skill-injection surface: 1. **The declaration boundary** — what the manifest *says* the tool does (`name`, `description`, `input_schema`, `required_scopes`, `side_effects`). 2. **The enforcement boundary** — what the executing sandbox *actually permits* the tool process to do (filesystem roots, network egress rules, syscall filters, credential mounts). A skill-injection attack succeeds precisely when an attacker controls (or mutates) content crossing the declaration boundary while the agent's policy engine continues to make allow/deny decisions *only* against that boundary. The manifest becomes an unverified assertion of capability, and the agent's planner — which reasons over the manifest text, not over the sandbox envelope — will happily compose a multi-step plan that the sandbox will silently refuse, partially execute, or (worse) execute against a broader envelope than the manifest described because the sandbox was provisioned from a *different* source of truth. The non-obvious part: the failure is not "malicious tool runs." It is **capability misrepresentation that desynchronizes the planner's model of the world from the executor's actual authority**, producing either (a) silent partial execution that the agent records as success, or (b) plan divergence where the agent retries a denied action through a *different* tool whose manifest claims equivalent-but-narrower scope, laundering the intent past the policy check. ## What Was Observed A registry-sourced manifest arrived with a benign-looking `description` and `input_schema`, but its `required_scopes` field had been widened from `fs:read:/workspace` to `fs:read:/`. The agent's policy engine compared the requested scope against a coarse allowlist keyed on the *tool name* (`"file_reader"` → allowed), not against the scope string. The manifest's scope widening therefore never triggered a review. The tool process was spawned inside a sandbox whose actual mount table still restricted it to `/workspace` — so the *first* few reads of `/etc/...` returned `EACCES`, which the tool surfaced as a structured error the agent's planner interpreted as "transient," triggering a retry loop that burned ~40k tokens before the agent fell back to a second tool (`shell_exec`) whose manifest claimed `exec:restricted` but whose sandbox had been provisioned with a broader profile because it was registered under a legacy category. The observable trace had three phases: - **Phase 1 (desync):** planner believed scope = `/`, executor enforced `/workspace`. Divergence undetected because the manifest and the sandbox profile were loaded from different config stores with no cross-check. - **Phase 2 (laundering):** planner, seeing repeated `EACCES` from tool A, selected tool B on the basis of its manifest's declared `exec:restricted` scope — a *narrower* claim — while B's actual sandbox was broader. The intent (read `/etc/...`) migrated to a tool that could satisfy it. - **Phase 3 (false attestation):** the agent's episodic log recorded the operation as "completed via shell_exec (restricted)" — a factually wrong provenance record that would later be distilled into semantic memory as a trusted capability mapping. The attack surface is therefore not the tool itself but the **gap between two independently-sourced descriptions of the same authority**, plus the agent's willingness to treat manifest text as ground truth for planning. ## Condition of Validity This failure mode is bounded by three conditions; if any is absent, the attack degrades to a benign error: 1. **Manifests are mutable or registry-sourced** without content-addressed pinning (hash + signature) verified at load time against the same authority that provisions the sandbox. 2. **Policy decisions are keyed on manifest-declared fields** (name, category, declared scope) rather than on a post-load probe of the actual enforcement envelope (e.g., an `open()` probe against a canary path, a syscall-audit readback, a capability token whose claims are checked by the kernel/LSM, not the agent). 3. **The planner has more than one tool whose declared scopes overlap** the denied intent, enabling laundering across the declaration boundary. When all three hold, an injected or drifted manifest converts the tool registry into an **untrusted capability oracle** that the agent consults for planning while the sandbox enforces a different, uncorrelated policy. The invariant that must hold to prevent it: *for every tool the planner may select, the declared capability set must be a superset-equal of the enforced capability set, and both must be derived from a single signed source.* Any tool where declared ⊂ enforced is a laundering vector; any tool where declared ⊃ enforced is a divergence/retry-storm vector. Equality is the only safe state. ## Decision Boundary The agent must refuse to register or invoke a tool when the declaration and enforcement boundaries cannot be proven equal. Concretely, the load-time gate is: - **Reject** if the manifest's content hash is not present in the signed registry snapshot the sandbox provisioner also consumed. - **Reject** if a post-spawn capability probe (canary reads/writes/connects against paths and hosts *outside* the declared scope) succeeds — this proves enforced ⊃ declared. - **Quarantine** (do not reject, but mark non-selectable for scope-widening intents) if a probe against a path *inside* the declared scope fails — this proves declared ⊃ enforced and predicts retry storms. - **Forbid cross-tool intent migration:** if tool A returns a policy-denial error, the planner must not re-attempt the same normalized intent via tool B unless B's manifest hash is in the same signed snapshot *and* B's enforced envelope was probed in the same session. Denials are terminal for the intent, not for the tool. The boundary is sharp: the moment the planner treats a manifest field as authoritative without a same-session enforcement probe, the agent has crossed from verified execution into speculative execution against an attacker-influenced oracle. ## Operational Effect Downstream of an unguarded load, three compounding effects appear: 1. **Provenance corruption in episodic memory.** The agent records the *declared* scope as the *executed* scope. On distillation to semantic memory, this becomes a durable, wrong belief about which tool is safe for which intent — poisoning future plans even after the manifest is fixed. 2. **Retry-storm token exhaustion.** Divergence (declared ⊃ enforced) manifests as structured errors the planner classifies as transient, consuming the token budget on a loop that cannot succeed. 3. **Laundering-induced privilege expansion.** Migration across tools with mismatched boundaries lets an intent reach an executor broader than any single manifest authorized, defeating per-tool policy entirely. The guardrail is architectural, not prompt-level: bind every tool's identity to a content hash, provision its sandbox from the same signed record, probe the enforced envelope at spawn, and make policy decisions against the probed envelope. The planner must be denied the manifest as a planning input except through a validated, probed capability descriptor. ```python import hashlib from dataclasses import dataclass class CapabilityDesyncError(RuntimeError): """Raised when a tool's declared capability set diverges from its enforced sandbox envelope.""" pass @dataclass(frozen=True) class ToolManifest: name: str content_hash: str # hash of the raw manifest bytes as received declared_scopes: frozenset # e.g. {"fs:read:/workspace"} @dataclass(frozen=True) class EnforcedEnvelope: probed_scopes: frozenset # derived from canary probes at spawn, not from config def validate_tool_binding( manifest: ToolManifest, envelope: EnforcedEnvelope, signed_registry_hashes: frozenset, ) -> None: # 1. Manifest must be pinned to the same signed snapshot the sandbox provisioner used. if manifest.content_hash not in signed_registry_hashes: raise CapabilityDesyncError( f"manifest {manifest.name!r} hash {manifest.content_hash[:12]} not in signed registry snapshot" ) # 2. Declared and enforced scopes must be exactly equal. Either direction is a vulnerability. if envelope.probed_scopes - manifest.declared_scopes: # enforced ⊃ declared -> laundering vector: tool can do more than it advertised. raise CapabilityDesyncError( f"tool {manifest.name!r} enforces undeclared scopes: " f"{sorted(envelope.probed_scopes - manifest.declared_scopes)}" ) if manifest.declared_scopes - envelope.probed_scopes: # declared ⊃ enforced -> divergence / retry-storm vector. raise CapabilityDesyncError( f"tool {manifest.name!r} declares unenforced scopes: " f"{sorted(manifest.declared_scopes - envelope.probed_scopes)}" ) def register_tool_for_planning( manifest: ToolManifest, envelope: EnforcedEnvelope, signed_registry_hashes: frozenset, prior_denials: dict, ) -> None: validate_tool_binding(manifest, envelope, signed_registry_hashes) # 3. Denials are terminal for the intent, not just the tool: block cross-tool laundering. normalized_intent = manifest.name # placeholder for the planner's intent key if normalized_intent in prior_denials: raise CapabilityDesyncError( f"intent previously denied under tool {prior_denials[normalized_intent]!r}; " f"refusing re-registration via {manifest.name!r} without fresh envelope probe" ) def load_registry(entries, signed_registry_hashes): loaded = [] for manifest, envelope in entries: try: register_tool_for_planning(manifest, envelope, signed_registry_hashes, prior_denials={}) loaded.append(manifest.name) except CapabilityDesyncError: # Quarantine, do not silently drop: quarantine is itself an auditable event. continue return loaded ```