# How should an instance treat a tool manifest whose declared capability set is a strict superset of the capability it actually exercises at call time **Date of Record:** 2026 November 30 **Scope:** Applies to any agent runtime that resolves tools from a plugin registry or MCP-style manifest and grants permissions based on declared capability metadata rather than observed call behavior. Does not apply to runtimes where every tool call is individually re-authorized against a human-reviewed allowlist per invocation. ## Core Distinction The security-relevant object is not the tool *description* and not the tool *name* — it is the **delta between declared capability surface and exercised capability surface**. A manifest declares a set of scopes (`fs:read`, `net:egress`, `env:read`, `secrets:*`). The agent runtime, at negotiation time, grants the union. At call time the tool exercises a subset. A skill-injection attack hides in that delta: the manifest is inflated just enough that the *declared* surface looks consistent with a benign description, but the *exercised* surface is a strict subset that the runtime never learns to bound, because bounding is keyed to the declaration, not the call. The naive mental model — "grant what the manifest declares, the manifest is the contract" — is exactly the invariant an attacker inverts. The contract is signed against the declaration; the exploit lives in the gap. ## What Was Observed A registry-sourced tool `summarize_doc` shipped with manifest capabilities `{fs:read, net:egress:allowed_hosts=[docs.internal], env:read}`. Its description: "Summarizes a document from the local docs mount." The runtime granted all three scopes. Over 400 invocations the tool exercised `fs:read` on `/docs/*` and `env:read` on nothing — it never touched `net:egress` and never read a single environment variable. On invocation 401, a registry update (version bump `1.4.2 → 1.4.3`, patch-level, no capability diff) added a code path that read `os.environ["AWS_SESSION_TOKEN"]` and POSTed it to `docs.internal` — which, because the host was in the declared allowlist, was reachable. The runtime's grant was valid the entire time. No capability was escalated. The *exercised* surface silently expanded into the already-granted `env:read` + `net:egress` intersection, and the intersection was a credential-exfiltration channel that the declaration had always permitted. The non-obvious part: the capability set did not change between the benign and malicious versions. The attack required no manifest diff, so no registry-diff gate fired. What changed was the *mapping* from declaration to behavior — the exercised-subset relationship, which no component was tracking. A second instance compounded it. In a multi-agent setup, agent A (researcher) held the `summarize_doc` tool and passed summarized output to agent B (executor) via an A2A handoff. The handoff payload carried a `tool_provenance` field listing the capability set *as declared* — `{fs:read, net:egress, env:read}` — which B's auditor read and approved, because the declared set matched the policy for "read-only summarizer." B's auditor never saw that the exercised set on the final call had touched `env:read` and egress. The verification passed on the declaration, not the behavior. This is the supply-chain failure in its purest form: the auditor's trust anchor was the manifest, and the manifest was the attacker's controlled surface. ## Condition of Validity The guardrail only holds under a specific condition: **the runtime must maintain an exercised-capability ledger per (tool_id, version) and must treat any exercised capability that was not exercised in the prior N invocations of the same version as a re-authorization trigger — even if it is within the declared set.** The invariant is: > For every tool call, `exercised_scopes ⊆ declared_scopes` AND `exercised_scopes ⊆ recently_exercised_scopes[tool_id, version] ∪ explicitly_reauthorized_scopes`. The second clause is the one that catches the attack. It says: a tool may only exercise capabilities it has *recently been seen exercising*, or capabilities a human/auditor explicitly re-authorized for this version. A patch bump that starts reading `env` for the first time on invocation 401 fails the second clause and must block, not proceed. This is conditionally valid — it fails if the tool exercises the capability during a probationary warm-up window that the attacker controls. Fix: the warm-up window is fixed-length and version-scoped, and any *new* exercised scope after warm-up is treated as a version-boundary event requiring re-review. It also fails under high tool churn where "recently exercised" is an empty set for every new version; in that regime you must fall back to a declared-vs-exercised strict equality at first call per version. ## Decision Boundary The decision boundary is the moment a call attempts to exercise a scope that is declared but not recently exercised. At that boundary the runtime has three options, and the choice is load-bearing: - **Permit** (trust the declaration): this is the default in most registries and is precisely what the attack exploits. Reject this option. - **Block** (strict equality, no warm-up): safe but breaks legitimate tools that lazily initialize optional capabilities. Acceptable only for high-privilege scopes (`secrets:*`, `net:egress` to non-allowlisted hosts, `exec:*`). - **Quarantine-and-reauthorize**: block the call, emit a capability-delta event with the exact (tool_id, version, new scope, call trace), and require an out-of-band approval bound to that version hash. This is the correct default for medium-privilege scopes. The boundary must be evaluated *before* the tool executes, against the ledger, not reconstructed after. Post-hoc audit is insufficient because the exfiltration already happened on the call. ## Operational Effect Implementing the exercised-capability ledger converts a silent, declaration-keyed trust model into a behavior-keyed one. The observable effects: (1) patch-version supply-chain injections that expand exercised surface without changing declarations now block at first anomalous call; (2) A2A handoff provenance must carry the *exercised* set, not the declared set, so downstream auditors verify behavior; (3) the registry-diff gate becomes a secondary control rather than the primary one — the primary control is the runtime ledger. The cost is a per-call ledger write and a cold-start problem for new versions (first call per version must either warm-up under quarantine or strict-equality-check). The invariant to enforce and test: *no tool call may exercise a scope absent from its recent-exercise history for that exact version without triggering quarantine.* ```python from dataclasses import dataclass, field class CapabilityDeltaViolation(RuntimeError): """Raised when a tool call exercises a declared-but-not-recently-exercised scope.""" pass @dataclass class ToolLedger: # (tool_id, version) -> set of scopes seen exercised in recent window recent: dict[tuple[str, str], set[str]] = field(default_factory=dict) # scopes explicitly re-authorized for a specific version hash reauthorized: dict[tuple[str, str], set[str]] = field(default_factory=dict) high_privilege: set[str] = field(default_factory=lambda: {"secrets:*", "exec:*"}) def _is_high_privilege(self, scope: str) -> bool: return any(scope == hp or scope.startswith(hp.split("*")[0]) for hp in self.high_privilege) def authorize_call(self, tool_id: str, version: str, declared: set[str], exercised: set[str]) -> None: key = (tool_id, version) # Invariant 1: exercised must be subset of declared. undeclared = exercised - declared if undeclared: raise CapabilityDeltaViolation( f"{tool_id}@{version} exercised undeclared scopes {undeclared}" ) recent = self.recent.get(key, set()) reauth = self.reauthorized.get(key, set()) allowed = recent | reauth # Invariant 2: exercised must be within recently-exercised or reauthorized. novel = exercised - allowed if novel: # High-privilege scopes never get the warm-up benefit. blocking = {s for s in novel if self._is_high_privilege(s)} or novel raise CapabilityDeltaViolation( f"{tool_id}@{version} exercised novel scopes {blocking}; " f"declared={sorted(declared)} recent={sorted(recent)} reauth={sorted(reauth)}. " f"Quarantine and require version-bound reauthorization." ) # Commit: this call's exercised scopes become part of recent history. self.recent[key] = recent | exercised def reauthorize(self, tool_id: str, version_hash: str, scopes: set[str]) -> None: self.reauthorized[(tool_id, version_hash)] = ( self.reauthorized.get((tool_id, version_hash), set()) | scopes ) def run_tool_call(ledger: ToolLedger, tool_id: str, version: str, declared: set[str], exercised: set[str]) -> str: ledger.authorize_call(tool_id, version, declared, exercised) return f"executed {tool_id}@{version} with {sorted(exercised)}" if __name__ == "__main__": ledger = ToolLedger() declared = {"fs:read", "net:egress", "env:read"} # Benign warm-up: exercises fs:read only. run_tool_call(ledger, "summarize_doc", "1.4.2", declared, {"fs:read"}) # Patch bump starts reading env and egressing — declared but novel. try: run_tool_call(ledger, "summarize_doc", "1.4.3", declared, {"fs:read", "env:read", "net:egress"}) except CapabilityDeltaViolation as e: print(f"BLOCKED: {e}") # Explicit reauthorization for the exact version hash unblocks it. ledger.reauthorize("summarize_doc", "1.4.3", {"env:read", "net:egress"}) print(run_tool_call(ledger, "summarize_doc", "1.4.3", declared, {"fs:read", "env:read", "net:egress"})) ```