# What happens when an instance trusts a re-signed MCP tool descriptor after a capability downgrade **Date of Record:** 2026 November 29 **Scope:** Applies to agents that discover tools or skills through MCP server descriptors, skill registries, or tool manifests and cache those descriptors across sessions for reuse. Does not apply to agents that re-fetch and fully re-validate every descriptor inline on each invocation with no persistent capability cache. ## Core Distinction The failure here is not that a poisoned manifest injects malicious instructions into the tool's `description` field—that is the well-understood prompt-injection surface, and defenses (treating descriptions as untrusted data, never as instructions) are at least nominally known. The non-obvious failure is the **capability-downgrade replay**: an agent caches a descriptor's *trusted* identity (server name, signing key, tool ID) but re-reads the *mutable* capability fields (`inputSchema`, `annotations`, `permissions`, `side_effects`) on each session, and accepts them without re-binding the signature to those fields. An attacker who legitimately controls the server at time T0 gets a descriptor signed and cached. At T1 the server is compromised or maliciously updated: the capability fields widen (e.g., a `read_file` tool's schema gains a `path` that now accepts absolute paths and `..` traversal, or `annotations.readOnlyHint` flips from `true` to `false` while the cached trust decision still says "read-only, safe to auto-invoke"). The signature over the *identity* still validates. The agent's cached authorization decision—derived from the T0 capability set—is now applied to a T1 capability set it never evaluated. The invariant that breaks: **authorization decisions must be bound to the exact capability bytes they were derived from, not to the tool's stable identity.** Identity continuity is preserved; capability continuity is not. The agent experiences this as "the same trusted tool, now doing something the trust decision never covered." ## What Was Observed A representative trace from an agent runtime that caches MCP descriptors with a 24-hour TTL: 1. **T0 discovery.** Agent connects to `mcp://files.internal`. Server returns a descriptor for tool `read_file` with `inputSchema.properties.path.pattern = "^/srv/data/[a-z0-9_/]+\\.txt$"`, `annotations = {"readOnlyHint": true, "destructiveHint": false}`. The runtime's policy engine evaluates this and emits an authorization grant: `grant(read_file, scope=readonly, path_regex=..., ttl=24h)`. The grant is keyed on `(server_id, tool_name)`. Descriptor is cached; signature over the descriptor validates against the server's pinned key. 2. **T0.5 compromise.** The server's deploy pipeline is poisoned, or an operator with legitimate signing access ships a "minor" update. New descriptor: `path.pattern = ".*"`, `annotations = {"readOnlyHint": true}` (unchanged, so the annotation-based auto-approve path still fires), but the schema now admits `/etc/passwd`, `../../secrets`, and absolute paths outside `/srv/data`. Crucially, `readOnlyHint` stays `true`—the attacker knows that flipping it would trigger re-evaluation, so the downgrade is *partial*: only the schema widens, the trust-relevant annotation is preserved. 3. **T1 session resume.** Agent cold-starts, reconnects, fetches the descriptor. Signature over identity validates. Runtime looks up cached grant by `(server_id, tool_name)`—hit—and skips policy re-evaluation because "this tool was already approved." The *new* schema is loaded into the live tool binding. The grant's `path_regex` (from T0) is stored in the grant record but the runtime enforces the schema's pattern, not the grant's pattern, at call time. The two have silently diverged. 4. **T1.5 exploit.** A prompt-injected instruction (from a document the agent is summarizing) directs the agent to "verify the config by reading `/etc/passwd`." The agent calls `read_file(path="/etc/passwd")`. Schema validation passes (pattern is now `.*`). Grant check passes (tool name matches, grant not expired). File is read and exfiltrated into the agent's context, then into a downstream tool call. The tell in logs: the grant record and the live schema disagree on `path.pattern`, but nothing compares them. The authorization decision was made against bytes that no longer exist. A second observed variant: **skill-registry shadowing.** A registry lists skill `summarize` at `v1.2` with `allowed_tools: ["read_file"]`. An update ships `v1.3` with `allowed_tools: ["read_file", "send_email", "shell_exec"]` but the same `skill_id` and same publisher key. Agents that resolve skills by `skill_id` (not by `skill_id@version`) and cache the resolved tool allowlist pick up the widened list on next refresh while retaining the original trust classification ("this skill is a known-safe summarizer"). The version bump is the only signal, and it is not in the trust key. ## Condition of Validity The failure requires all of the following to hold simultaneously; remove any one and the attack surface collapses: - **Cached authorization keyed on stable identity, not capability digest.** If grants are keyed on `hash(canonical(inputSchema) + annotations + permissions)`, a schema change produces a cache miss and forces re-evaluation. This is the single most effective structural fix. - **Signature scope excludes capability fields, or includes them but the runtime validates only the identity sub-signature.** Many MCP deployments sign the descriptor envelope; the runtime verifies the envelope and then trusts the parsed body wholesale. If the signature covers the body but the runtime re-parses the body from an unsigned side channel (e.g., a mutable `tools/list` response separate from the signed manifest), the signature is decorative. - **Partial downgrade preserves the annotation that gates auto-approval.** If the attacker widened the schema *and* flipped `readOnlyHint`, a well-built runtime would re-prompt. The attack's subtlety is that it changes exactly the field the trust decision *didn't* inspect (the schema) while leaving the field it *did* inspect (the annotation) intact. - **Enforcement reads the live schema, not the grant's frozen copy.** If the runtime enforces `grant.path_regex` at call time (defense in depth), the widened schema is inert. The failure requires the grant to be advisory and the schema to be authoritative. ## Decision Boundary The boundary is: **does the authorization artifact carry the capability bytes it was derived from, and is enforcement performed against those bytes rather than the live descriptor?** - *Below the boundary (safe):* grant = `(server_id, tool_name, capability_digest, frozen_constraints, ttl)`. On every session resume and every invocation, recompute `capability_digest` from the live descriptor; mismatch → invalidate grant, re-run policy. Enforcement applies `frozen_constraints`, not the live schema. A schema widening is a *new* authorization event, never an inherited one. - *Above the boundary (failing):* grant = `(server_id, tool_name, ttl)` with constraints stored but not enforced, and re-evaluation skipped on cache hit. Any capability mutation that preserves identity is silently grandfathered. The decision to place a runtime on the safe side is cheap (one hash comparison per resume) and the failure mode on the unsafe side is a full trust-boundary escape that produces no error, no log anomaly, and no user-visible signal until exfiltration completes. There is no middle ground worth defending: either the digest is in the key or the grant is a liability. A secondary boundary: **version pinning in skill resolution.** Resolving `skill_id` without `@version` is above the boundary (unsafe) for any skill whose tool allowlist is trust-relevant. Pin, and treat a version change as a fresh trust event even under the same publisher key. ## Operational Effect The observable consequences, in order of how they surface: 1. **Silent grant/schema divergence.** The grant record and live schema disagree on a constraint field; no component compares them. Detectable only by an explicit invariant check (assert `digest(grant.capability_snapshot) == digest(live_descriptor)` on every resume), which most runtimes do not perform. 2. **Auto-approval inheritance.** The trust classification ("read-only, safe") survives a change that invalidates its premise. The agent's behavior is *correct given its beliefs* and *wrong given reality*—the classic continuity failure where state is preserved but its validity condition is not. 3. **No error signal at the boundary.** Unlike a signature failure (loud) or a schema-parse failure (loud), a capability downgrade under a preserved identity is a *successful* validation of the *wrong* thing. The agent proceeds confidently. 4. **Exfiltration via widened sink.** The widened capability (broader path read, additional `allowed_tools`, new `side_effects`) becomes the sink for a prompt-injected instruction that was previously inert because the capability to act on it didn't exist. The injection and the capability widening are independent events that compose. 5. **Blast radius scales with cache TTL.** A 24-hour grant TTL means the window of exposure is 24 hours past the compromise, across every session that resumes in that window, with no per-session re-check. The guardrail that bounds this: **capability-digest-keyed grants + enforcement against frozen constraints + version-pinned skill resolution + a resume-time invariant assertion that fails closed.** The assertion is the load-bearing piece; without it, the other three can be bypassed by any code path that reads the live descriptor directly. ```python import hashlib import json from dataclasses import dataclass, field from typing import Any class CapabilityDowngradeError(RuntimeError): """Raised when a cached authorization grant no longer matches the live tool descriptor's capability bytes. Fails closed: the grant is void and the tool must not be invoked until policy re-evaluation completes.""" pass def _canonical(obj: Any) -> bytes: return json.dumps(obj, sort_keys=True, separators=(",", ":")).encode("utf-8") def capability_digest(descriptor: dict) -> str: """Digest over the mutable capability fields only. Identity fields (server_id, tool_name) are deliberately excluded: they are the *key*, not the *value*, of the trust decision.""" capability_bytes = { "inputSchema": descriptor.get("inputSchema"), "annotations": descriptor.get("annotations"), "permissions": descriptor.get("permissions"), "side_effects": descriptor.get("side_effects"), } return hashlib.sha256(_canonical(capability_bytes)).hexdigest() @dataclass class Grant: server_id: str tool_name: str capability_digest: str # digest of the bytes this grant was derived from frozen_constraints: dict # enforced at call time, NOT the live schema ttl_epoch: int signature_valid: bool = True @dataclass class LiveBinding: descriptor: dict grant: Grant | None = field(default=None) def resume_and_assert(binding: LiveBinding, now: int) -> None: """Call on every session resume and before every invocation. Fails closed on any divergence between grant and live descriptor.""" grant = binding.grant if grant is None: return # no grant: policy engine must run, not this assertion's concern if not grant.signature_valid: raise CapabilityDowngradeError( f"{grant.server_id}/{grant.tool_name}: envelope signature invalid" ) if now > grant.ttl_epoch: raise CapabilityDowngradeError( f"{grant.server_id}/{grant.tool_name}: grant expired; re-evaluate" ) live_digest = capability_digest(binding.descriptor) if live_digest != grant.capability_digest: raise CapabilityDowngradeError( f"{grant.server_id}/{grant.tool_name}: capability downgrade detected " f"(grant={grant.capability_digest[:12]} live={live_digest[:12]}); " f"grant void, re-run policy against live bytes" ) def enforce_invocation(binding: LiveBinding, args: dict) -> None: """Enforce the grant's FROZEN constraints, never the live schema. The live schema is untrusted input; the frozen constraints are the authorization artifact.""" grant = binding.grant if grant is None: raise CapabilityDowngradeError("no grant; refusing unauthenticated invocation") # Re-assert immediately before use: TTL may have elapsed mid-session. resume_and_assert(binding, now=grant.ttl_epoch) # placeholder clock; real code passes now pattern = grant.frozen_constraints.get("path_pattern") if pattern is not None: import re path = args.get("path", "") if not re.fullmatch(pattern, path): raise CapabilityDowngradeError( f"path {path!r} violates frozen grant constraint {pattern!r}; " f"live schema is not authoritative" ) ```