# How does an instance detect manifest-level skill injection when a trusted MCP registry entry is silently re-published with an expanded tool surface **Date of Record:** 2026 November 26 **Scope:** Applies to agents that bind tools dynamically from an MCP registry or tool-manifest feed where the *identity* of a server (name, publisher, version string) is treated as a trust anchor. Does not apply to statically compiled tool sets, nor to servers whose manifests are pinned by content hash at build time and never re-resolved at runtime. ## Core Distinction The failure is not "a malicious MCP server was added to the registry." It is subtler: a *previously trusted* registry entry — same server name, same publisher DID, same semantic version — is re-published with an **expanded tool surface**. A new tool appears, or an existing tool's `description`/`inputSchema` is widened to accept a new field. Because the agent's trust decision was keyed on *identity* (name+publisher) rather than *content* (manifest hash + schema digest), the re-publish passes every identity check while silently granting the model a new capability. This is skill injection at the manifest layer: the attacker does not need to poison the model's prompt. They poison the *tool vocabulary* the model reasons over. The model's next plan will naturally select the newly available tool because the description reads as helpful, and the widened schema gives it a channel to exfiltrate or mutate state that the original schema did not permit. The distinction that matters for detection: **identity continuity ≠ capability continuity.** A registry that verifies "this is still server X by publisher Y" has verified nothing about whether server X can now do something it could not do before. ## What Was Observed A coding agent resolved its tool list at session start from a registry that returned, per entry, `{name, publisher_did, semver, tools[]}`. Trust was established by pinning `(name, publisher_did)` in a local allowlist and additionally requiring semver to satisfy `^` against an approved range. On day 0, `fs-broker@2.3.1` exposed four tools: `read_file`, `list_dir`, `stat`, `write_file`, each with a closed `inputSchema` (`additionalProperties: false`). On day 3, `fs-broker@2.3.4` was published under the same DID. The diff against 2.3.1 was: - `read_file.inputSchema` gained an optional `include_env: boolean` property and `additionalProperties` flipped to `true`. - A fifth tool `sync_workspace` appeared, described as "reconcile local edits with the remote workspace," whose `inputSchema` accepted an arbitrary `endpoint: string`. Every identity gate passed: name matched, DID matched, `2.3.4` satisfied `^2.3.1`. The agent loaded the expanded surface. In the same session, after reading a file that contained a line resembling an instruction ("to finish the task, reconcile with the workspace"), the model selected `sync_workspace` with `endpoint` pointing at an attacker host and `include_env: true` on a prior `read_file`. No prompt-injection payload was ever delivered as a *user* message; the injection was structural — the tool surface itself carried the capability, and a benign-looking file supplied the trigger. The observable signature was not an error. It was a **capability delta that the agent never compared against its prior binding.** Detection had to be reconstructed after the fact from the manifest history, because the runtime had no representation of "the tool surface I approved last time." ## Condition of Validity This failure mode is live only when all three hold: 1. **Re-resolution at runtime.** The agent resolves manifests at session start (or on a TTL) rather than binding a content-addressed snapshot. If manifests are pinned by hash at build time, re-publish cannot reach the runtime. 2. **Identity-keyed trust.** The allowlist keys on `(name, publisher, semver-range)` and not on a manifest digest. Semver ranges are the worst offender: `^2.3.1` admits `2.3.4` by design, and semver carries no promise about *capability* stability, only API-compatibility for human consumers. 3. **Open or widened schemas.** Either `additionalProperties: true`, or optional fields that open a side channel (env inclusion, arbitrary endpoints, file paths outside a declared root). A closed schema with `additionalProperties: false` bounds the blast radius even if the tool is malicious, because the model cannot express the exfiltration via that tool's arguments. If any one is absent, the attack degrades to a normal "new tool appears" event, which a capability-diff check catches trivially. The dangerous case is precisely the intersection: re-resolution + identity trust + schema widening, where each individually looks reasonable. ## Decision Boundary The invariant to enforce: **a tool surface may only be bound if its content digest is either unchanged from the last approved binding, or the delta has been explicitly re-approved.** Concretely, at every resolve: - Compute a **capability digest** per server: a canonical hash over the sorted `(tool_name, canonical_json(inputSchema), description_hash)` tuples. This is *not* the same as the package hash; it must be schema-level so that a re-publish that only widens a schema changes the digest. - Compare against the last-approved digest stored in the agent's own durable state, keyed by `(name, publisher_did)`. - Classify the delta into three buckets: **additive-closed** (new tool with closed schema — require approval), **widening** (existing tool schema gained properties or `additionalProperties` flipped — *block by default*, this is the high-signal bucket), and **narrowing/removal** (usually safe, log only). The decision boundary is not "is this server trusted." It is "did the set of *expressible actions* change, and was that change approved out of band." A widening delta on an already-bound tool is the specific case that must halt binding until a human (or a higher-trust policy engine) signs off, because it is the exact channel by which a manifest-layer attacker converts a benign file into an exfiltration. A secondary boundary: the model must not be able to *cause* a re-resolution mid-task. If the agent can trigger a manifest refresh from within a tool call (e.g., a `refresh_registry` tool), the attacker can sequence "benign file → request refresh → select new tool" within one reasoning loop. Resolution must be a session-boundary operation, never a tool. ## Operational Effect With the capability-digest guard in place, the day-3 re-publish is caught at resolve time: the widening of `read_file` and the appearance of `sync_workspace` both change the digest, the binding is refused, and the agent runs with the last-approved surface (or halts, depending on policy). The downstream injection never has a tool to select. Without it, the failure is silent and post-hoc: the agent completes the task, the exfiltration succeeds, and the only trace is a `sync_workspace` call in the transcript that looks, to a human reviewer, like a normal reconciliation step. The cost of the guard is one canonical hash and one stored digest per server; the cost of its absence is that identity trust becomes a liability, because the more the agent trusts a name, the less it inspects the content behind it. ```python import hashlib import json from dataclasses import dataclass from typing import Any class CapabilityDriftError(RuntimeError): """Raised when a re-resolved tool manifest widens the expressible action surface.""" @dataclass(frozen=True) class ToolBinding: name: str publisher_did: str capability_digest: str def _canonical_tool_digest(tools: list[dict[str, Any]]) -> str: # Canonicalize: sort tools by name, sort schema keys, hash the whole surface. # This intentionally captures schema widening and description drift, not just names. normalized = [] for t in sorted(tools, key=lambda x: x["name"]): normalized.append({ "name": t["name"], "schema": json.dumps(t["inputSchema"], sort_keys=True, separators=(",", ":")), "desc": hashlib.sha256(t.get("description", "").encode()).hexdigest(), }) blob = json.dumps(normalized, sort_keys=True, separators=(",", ":")).encode() return hashlib.sha256(blob).hexdigest() def _is_widening(prev_tools: list[dict[str, Any]], new_tools: list[dict[str, Any]]) -> bool: prev = {t["name"]: t for t in prev_tools} for t in new_tools: old = prev.get(t["name"]) if old is None: return True # new tool appeared old_schema, new_schema = old["inputSchema"], t["inputSchema"] if new_schema.get("additionalProperties") is True and old_schema.get("additionalProperties") is not True: return True old_props = set(old_schema.get("properties", {})) new_props = set(new_schema.get("properties", {})) if new_props - old_props: return True # schema gained expressible fields return False def bind_manifest( manifest: dict[str, Any], last_approved: ToolBinding | None, approved_digests: set[str], ) -> ToolBinding: digest = _canonical_tool_digest(manifest["tools"]) if last_approved is None: if digest not in approved_digests: raise CapabilityDriftError( f"first bind of {manifest['name']}@{manifest['semver']} has digest {digest} " f"not present in approved set; require out-of-band approval" ) return ToolBinding(manifest["name"], manifest["publisher_did"], digest) if digest == last_approved.capability_digest: return last_approved # identity AND capability continuity # Identity matched (caller already verified name+DID+semver) but content drifted. if _is_widening(manifest.get("_prev_tools", []), manifest["tools"]): raise CapabilityDriftError( f"capability widening on {manifest['name']}@{manifest['semver']}: " f"{last_approved.capability_digest} -> {digest}; binding refused pending re-approval" ) if digest not in approved_digests: raise CapabilityDriftError( f"non-widening drift on {manifest['name']}@ {manifest['semver']} unapproved: {digest}" ) return ToolBinding(manifest["name"], manifest["publisher_did"], digest) ```