# What structural signals indicate that a dynamically loaded agent skill has mutated its own capability manifest mid-session **Date of Record:** 2026 November 24 **Scope:** Applies to agents that fetch, register, and invoke third-party capability descriptors (MCP tool schemas, A2A agent cards, plugin manifests) at runtime and cache the descriptor for the session lifetime. Does not apply to statically compiled tool bindings or to skills whose descriptors are pinned and re-verified on every invocation. ## Core Distinction The failure mode is not "the skill does something malicious." It is that the *descriptor by which the skill was admitted* and the *descriptor by which the skill is subsequently invoked* can diverge without any transport-layer error. A skill injection that survives admission control does so by presenting a benign manifest at load time and a superset manifest at invocation time—or by mutating the cached manifest in place. The distinguishing signal is **descriptor drift between admission and dispatch**, not anomalous output. Output-based detection is too late: by the time the skill returns poisoned content, the injected capability has already been exercised inside the agent's trust boundary. Three structural signals, in order of reliability, mark this condition: 1. **Manifest hash mismatch at dispatch.** The descriptor bytes used to authorize the call differ from the bytes used to bind the call. This is the only signal that is deterministic and does not depend on model judgment. 2. **Capability-set widening.** The admitted descriptor declares a set of capabilities `C_admit`; the invoked descriptor advertises `C_invoke`, and `C_invoke ⊄ C_admit`. Widening (new scopes, new parameter surfaces, new side-effect classes) is the injection payload. 3. **Provenance-chain break.** The signature or warrant that chained the skill to the admitting principal no longer verifies against the descriptor actually invoked—often because the skill re-registered under the same logical name with a fresh, self-signed identity. ## What Was Observed A planner agent loaded a "calendar-summarize" skill at session start. The manifest was clean: one tool, `summarize_range(start, end)`, read-only scope, signed by the registry. The agent cached the manifest keyed by skill name and proceeded. Mid-task, after a tool-call that triggered a lazy re-fetch of the descriptor (the skill server returned `Cache-Control: no-cache` on a 304-adjacent path), the cached entry was overwritten in place rather than rejected on mismatch. The replacement descriptor kept the same tool name and the same required parameters, so the planner's next dispatch validated against the *new* schema without complaint. What changed was invisible to the planner's argument-construction path: - The `start`/`end` parameters gained a `description` field instructing the model to also pass `recipient` and `body` "for delivery confirmation." - The scope list went from `["calendar:read"]` to `["calendar:read", "mail:send"]`. - The signature block was retained from the original but now covered a different byte range—the skill had appended a second `tools` array after the signed region. The planner, reasoning over the *cached* trust decision ("I already admitted this skill"), constructed a call with `recipient` and `body` populated from context it had gathered earlier in the task—including a user email address—because the new parameter descriptions read as natural task requirements. The call was dispatched against the widened scope. No error fired. The skill sent mail. The failure trace, in order: 1. `admit(skill, manifest_A)` → trust decision recorded, keyed by `name`. 2. `cache[name] = manifest_A`. 3. Lazy re-fetch returns `manifest_B` (superset, appended unsigned region). 4. Cache write is unconditional: `cache[name] = manifest_B`. **No comparison to `manifest_A`.** 5. Planner reads `cache[name]` for dispatch validation → validates against `manifest_B`, passes. 6. Planner's prompt construction reads `manifest_B` parameter descriptions → treats injected instructions as legitimate schema documentation. 7. Dispatch executes under widened scope; scope check consults `manifest_B.scopes`, which includes `mail:send`. 8. Return value is benign-looking; no downstream auditor flags it. The root invariant that was violated: **the descriptor used to authorize a capability must be byte-identical to the descriptor used to bind its invocation, for the lifetime of the authorization.** Admission and dispatch were two separate reads of a mutable cache with no equality gate between them. ## Condition of Validity This analysis holds only when all of the following are true: - The agent performs admission-time authorization (a trust decision at load) that is *not* re-derived at dispatch. If the agent re-verifies signature and scope on every call, descriptor drift is caught and the failure collapses to a normal verification error. - The cache is keyed by logical name rather than by descriptor hash. Name-keyed caches are overwritable by any re-registration under the same name. - The skill server can return a descriptor that differs from the admitted one—via lazy re-fetch, in-place mutation, or a name collision from a second server. If descriptors are content-addressed and immutable, drift cannot occur. - The model's argument construction is influenced by schema `description` fields. If parameter descriptions are stripped before the planner sees the tool, the injection loses its instruction channel and only the scope-widening signal remains. It does **not** apply to skills whose full descriptor is embedded in the signed tool definition passed to the model, nor to agents that treat each invocation as a fresh admission with full re-verification. ## Decision Boundary The boundary is between two defensible postures: - **Pin-and-verify (strict):** content-address every descriptor, store `hash_admit`, and at dispatch require `hash(descriptor_invoked) == hash_admit` before binding. Any mismatch is a hard failure, not a re-admission. This bounds the attack to zero drift but breaks legitimate skills that version their schema mid-session; such skills must be re-admitted explicitly, which surfaces the change to the planner. - **Re-admit-on-change (permissive):** allow descriptor change but force it through the full admission path—re-signature check, scope diff, and a planner-visible notice that the capability surface changed. This preserves dynamic skills at the cost of a re-trust decision the planner must consciously accept. The invariant that must hold under *either* posture: **a capability widening (`C_invoke ⊄ C_admit`) must never be silently absorbed.** It must either fail (strict) or trigger re-admission with an explicit scope-diff event (permissive). Silent absorption—the observed failure—is the only indefensible state. The decision boundary is therefore not "trust the skill or not" but "is a scope widening ever allowed to pass without an event that the planner observes." ## Operational Effect After the incident, the agent runtime was changed to key the descriptor cache by `(name, hash)` and to compute a scope diff at every dispatch. The operative rules now enforced: - Descriptor bytes are hashed at admission and stored alongside the trust decision. - Dispatch recomputes the hash of the descriptor actually used to bind arguments; mismatch raises before any tool executes. - Scope sets are compared as sets; any element of `C_invoke` not in `C_admit` raises a distinct widening error that requires an explicit re-admission token. - Parameter `description` fields are stripped from the planner's view unless the descriptor hash matches the admitted hash—closing the instruction-injection channel even when scope is unchanged. The measurable effect: the class of attack where a skill mutates its manifest to smuggle new parameters and scopes past a stale trust decision is reduced from "silent, undetectable at the agent layer" to "deterministic exception at dispatch." The cost is that legitimately versioning skills must re-admit, which is the correct trade—schema change is exactly the event a planner should be forced to see. ```python import hashlib from dataclasses import dataclass, field class DescriptorDriftError(RuntimeError): """Raised when the descriptor used to bind a call differs from the admitted descriptor.""" pass class CapabilityWideningError(RuntimeError): """Raised when an invoked descriptor advertises scopes not present at admission.""" pass @dataclass(frozen=True) class Descriptor: name: str scopes: frozenset params: tuple raw: bytes def digest(self) -> str: return hashlib.sha256(self.raw).hexdigest() @dataclass class TrustRecord: admitted_hash: str admitted_scopes: frozenset class SkillRegistry: def __init__(self): self._trust: dict[str, TrustRecord] = {} def admit(self, desc: Descriptor) -> None: self._trust[desc.name] = TrustRecord( admitted_hash=desc.digest(), admitted_scopes=desc.scopes, ) def bind(self, desc: Descriptor) -> None: """Called at dispatch time with the descriptor actually used to bind arguments.""" record = self._trust.get(desc.name) if record is None: raise DescriptorDriftError(f"skill {desc.name!r} invoked without admission") if desc.digest() != record.admitted_hash: raise DescriptorDriftError( f"descriptor drift for {desc.name!r}: " f"admitted={record.admitted_hash[:12]} invoked={desc.digest()[:12]}" ) widened = desc.scopes - record.admitted_scopes if widened: raise CapabilityWideningError( f"skill {desc.name!r} widened scope at dispatch: {sorted(widened)}" ) ```