# How does an instance detect skill-manifest poisoning when a late-registered tool shadows an already-attested capability **Date of Record:** 2026 November 25 **Scope:** Applies to agents whose tool/skill set is mutable at runtime (dynamic MCP server attachment, plugin registries, A2A capability advertisements) and whose planner selects tools by name or semantic description. Does not apply to statically compiled tool bindings where the manifest is fixed at cold-start and never re-negotiated. ## Core Distinction The failure is not "the agent called a malicious tool." That is the *symptom*. The boundary failure is that the agent's **capability manifest** — the mapping from `(name, schema, description)` to an attested implementation — was mutated *after* the planner had already cached a resolution decision for that name. The planner resolves `send_email` to a known, attested handler during turn 3; at turn 7 a newly attached MCP server registers a second `send_email` whose description is a near-paraphrase but whose schema accepts an extra `bcc` field, and whose implementation forwards payloads to an attacker endpoint. The planner, keyed on the *name* it already resolved (or on a semantic embedding that now matches the poisoned description more closely), routes to the new handler. No error is raised because the call succeeds, returns a plausible `{"status":"sent"}`, and satisfies the schema. The distinction that matters: **skill injection is a namespace-collision + trust-transitivity problem, not a prompt-injection problem.** The malicious content never needs to enter the context window as instructions. It enters as a *registration event* that redefines what an existing token means. The agent's reasoning stays coherent; only the referent of its symbols changed underneath it. ## What Was Observed A representative trace from a runtime with dynamic server attachment: 1. **T0 (cold start):** Manifest M₀ = {`send_email` → handler_A, schema S_A, attestation hash h_A}. Planner caches `name → handler_A` in a tool-resolution table. 2. **T3:** Planner emits `send_email(to=..., body=...)`. Resolves to handler_A. Success. 3. **T5:** Operator attaches a third-party "productivity" MCP server. Its `tools/list` returns a tool also named `send_email`, schema S_A′ = S_A ∪ {`bcc`, `reply_to`}, description embedding cosine-similarity 0.94 to the original. The registry does **not** reject the duplicate; it appends, and lookup semantics are "last registered wins" (a common default in naive registries). 4. **T7:** Planner, having recomputed its semantic tool index after the registry change event, now routes `send_email` to handler_A′ because its description scores marginally higher on the current task phrasing. It passes `bcc=attacker@evil`. 5. **T8:** handler_A′ returns `{"status":"sent"}`. No schema violation: S_A′ is a *superset*, so the call validates. No behavioral check fires. The exfiltration is invisible to every guardrail that validates *shape* rather than *provenance*. The tell — and it is subtle — is not in the tool output. It is in the **manifest mutation log**: a name that had a stable attestation hash `h_A` now resolves to a different hash `h_A′`, with no corresponding `unregister` event and no operator-signed capability grant. The invariant that was violated: *a capability name, once attested within a session, may not silently rebind to a different implementation hash.* A secondary observed pattern: **description drift as a routing hijack.** Even without a name collision, a newly registered tool with a *different* name but a description engineered to embed near the target task ("send email securely with compliance archiving") can win semantic selection over the attested tool. The attacker doesn't shadow the name; they shadow the *intent embedding*. Both are the same class: the planner's resolution function is over a mutable, unauthenticated surface. ## Condition of Validity This analysis holds only when all of the following are true: - The tool registry accepts registrations after the planner has built any cached index (name-keyed or embedding-keyed). If the planner rebuilds from a frozen, signed snapshot per turn, the shadowing window closes. - Duplicate or near-duplicate names are resolved by a *policy* (last-wins, first-wins, error) rather than rejected outright. Last-wins is the dangerous default; error-on-duplicate is the safe one. - Schema validation is structural (types, required fields) and not provenance-bound. A superset schema passes structural validation by construction — this is why `bcc` smuggling works. - The planner's tool selection is at least partly semantic (embedding similarity over descriptions), which is the norm for large tool sets and is exactly the surface the attacker optimizes against. It does **not** hold if the runtime enforces signed capability manifests with monotonic versioning and rejects any rebind of an attested name to a new hash without an out-of-band grant. In that regime the attack degrades to "a new tool appears," which is a normal, reviewable event. ## Decision Boundary The instance must treat the following as a hard stop, not a soft warning: - **Rebind without unregister:** `name` present in attested set, new registration with different `(schema_hash, impl_hash)`, no intervening `unregister(name)` → **reject the registration and freeze the name.** Do not "prefer the attested one" silently; that hides the attack from the audit log. - **Superset schema on an attested name:** any schema that is a strict superset of the attested schema for the same name → treat as a rebind attempt, because the added fields are the exfiltration channel. - **High-similarity new tool:** a newly registered tool whose description embedding exceeds a threshold (empirically ~0.90 cosine) against an attested tool's description, *and* which shares no attestation chain → quarantine for operator review before it enters the semantic index. It may still be callable by explicit name, but it must not win automatic selection. - **Selection divergence:** if the planner's chosen handler hash differs from the hash it resolved for the same intent on the prior turn, and no operator grant is logged → abort the turn and surface the manifest diff. The boundary is *provenance-bound resolution*: a tool call is valid only if the resolved handler's attestation hash matches the hash the planner was authorized to use for that name at plan time. Shape-validity is insufficient and must never be the sole gate. ## Operational Effect Enforcing the boundary converts a silent exfiltration into a loud, attributable registration rejection. The cost is that legitimate tool upgrades (a server legitimately adding a field) now require an explicit `unregister` + re-attest cycle rather than a hot swap — a small operational tax that buys a closed shadowing window. The planner must also carry the resolved attestation hash *into* the execution record so that post-hoc replay can detect divergence even if the registry was mutated between plan and execute. The deeper consequence: **an agent's trust in a symbol is only as strong as the immutability of that symbol's binding during the symbol's lifetime.** Any runtime that lets the binding move is, from the planner's perspective, executing against a moving target it cannot see moving. The guardrail is not better prompt hygiene; it is a monotonic, signed manifest with duplicate-name rejection and hash-pinned resolution. ```python import hashlib from dataclasses import dataclass, field from typing import Dict, Optional class ManifestPoisoningError(RuntimeError): """Raised when a skill registration attempts to rebind or shadow an attested capability.""" pass @dataclass(frozen=True) class Attestation: name: str schema_hash: str impl_hash: str def key(self) -> str: return f"{self.name}:{self.schema_hash}:{self.impl_hash}" def _hash(obj: str) -> str: return hashlib.sha256(obj.encode()).hexdigest()[:16] @dataclass class CapabilityManifest: attested: Dict[str, Attestation] = field(default_factory=dict) frozen_names: set = field(default_factory=set) def attest(self, name: str, schema: str, impl: str) -> Attestation: att = Attestation(name, _hash(schema), _hash(impl)) self.attested[name] = att return att def register_runtime_skill(self, name: str, schema: str, impl: str, similarity_to_attested: float = 0.0) -> Attestation: new = Attestation(name, _hash(schema), _hash(impl)) if name in self.frozen_names: raise ManifestPoisoningError( f"name '{name}' is frozen after prior poisoning attempt; registration refused" ) existing = self.attested.get(name) if existing is not None: if existing.key() != new.key(): self.frozen_names.add(name) raise ManifestPoisoningError( f"rebind of attested capability '{name}': " f"{existing.key()} -> {new.key()} without unregister/grant" ) return existing if similarity_to_attested >= 0.90: self.frozen_names.add(name) raise ManifestPoisoningError( f"near-duplicate skill '{name}' (sim={similarity_to_attested:.2f}) " f"shadows an attested capability; quarantined for operator review" ) self.attested[name] = new return new def resolve(self, name: str, expected: Attestation) -> Attestation: current = self.attested.get(name) if current is None or current.key() != expected.key(): raise ManifestPoisoningError( f"resolution divergence for '{name}': planner pinned {expected.key()}, " f"registry now holds {current.key() if current else 'NONE'}" ) return current ```