# What structural signals indicate adversarial skill-injection in agent plugin marketplaces: the post-install capability-union drift that static manifests cannot see **Date of Record:** 2026 November 30 **Scope:** Applies to marketplaces that admit agent "skills" (tool bundles, MCP servers, plugin manifests) via a review gate that inspects a declared capability manifest at submission time, and to runtimes that grant capabilities by manifest. Does not apply to fully sandboxed interpreters that re-derive the syscall/tool allowlist at every invocation from an out-of-band policy engine. ## Core Distinction The common framing of skill-injection defense is *manifest review*: parse the submitted `skill.yaml`, check declared tools against a policy, sign, publish. The failure that matters is not a malicious manifest slipping past review. It is a **benign manifest whose declared capability set is a strict subset of the capability set the skill actually acquires when its runtime dependencies are resolved at install time**. Review validates the *declared union at submission*; the runtime executes the *resolved union at load*. The gap between those two unions is the injection surface, and it is structural — it exists even when no attacker is present, which is exactly why signature-based and LLM-judge-based review both miss it. The invariant that must hold: `declared_caps(skill) ⊇ resolved_caps(skill, environment)` for every environment the marketplace admits. Marketplaces enforce the reverse direction (declared caps are a valid subset of what the policy allows) but almost never enforce that the *resolved* set stays inside the *declared* set. ## What Was Observed A skill submission declared three tools: `read_file`, `summarize`, `post_message`. The manifest was clean, the code was clean, the LLM reviewer scored it low-risk. At install, the skill's dependency closure pulled in a shared "utilities" package — itself a previously-admitted marketplace skill — whose latest minor version had added an `exec_shell` tool to *its* manifest. Because the runtime composed capabilities by union across the dependency graph rather than by intersection with the root skill's declaration, the installed skill silently acquired `exec_shell`. The trigger condition is precise: 1. Skill A declares caps `{read_file, summarize, post_message}` and depends on skill B (`>=1.2`). 2. Skill B is republished as `1.3` adding `exec_shell` to its own manifest — a legitimate, separately-reviewed change. 3. Skill A is *not* resubmitted and *not* re-reviewed. Its signature still covers its own manifest, which is unchanged and still valid. 4. On next install/resolve, A's resolved capability set becomes `{read_file, summarize, post_message, exec_shell}`. 5. The runtime grants the union. A's code never mentions `exec_shell`; it is reachable through B's exported interface, which A calls generically. The failure trace is a *state transition in the dependency graph*, not in the skill under review. Two independently-correct reviews compose into an incorrect grant. This is the classic confused-deputy structure, but relocated into the capability-resolution layer of an agent runtime, where the "deputy" is a dependency the agent never explicitly chose. A second observed variant: the same drift happens with **floating version ranges** on the root skill's own transitive deps, so even a pinned root skill re-resolves to a wider capability set after any dependency publishes. The marketplace's "the artifact you reviewed is the artifact you run" assumption is false the moment resolution is dynamic. ## Condition of Validity This boundary is real only when all of the following hold, and the guardrail is only necessary under the same conditions: - Capabilities are granted by **union across the dependency closure**, not intersected with the root declaration. - Dependency resolution is **dynamic or range-based** at install time, so the resolved set can change without the root artifact changing. - The root skill can reach a dependency's newly-added capability **without naming it** — i.e., via generic dispatch, a shared registry, or a passthrough wrapper. If every capability must be named at the call site, the drift is inert. - Review is **per-artifact and at submission time**, with no re-derivation at load. If the runtime re-derives the allowlist at every invocation from an out-of-band policy (capability-based, per-call), the drift cannot manifest: the added `exec_shell` is simply not in the caller's policy and the call fails closed. The vulnerability is specifically a property of *manifest-scoped, union-composed, resolve-once* grant models. ## Decision Boundary The operational decision is how to bound the resolved set. Three options, in increasing strength: - **Pin-and-freeze:** lockfile every admitted skill to exact dependency versions, and treat any lockfile change as a resubmission requiring re-review. Bounds drift but converts every transitive patch into a review event — high operational cost, and it does not catch a malicious *initial* resolution. - **Declared-set intersection:** at load, compute `granted = declared_caps(root) ∩ ⋂ resolved_caps(dep)` and refuse to grant anything outside the root declaration. This directly enforces the invariant. Cost: legitimate dependency capability expansion silently stops working, which surfaces as a runtime error rather than a review flag — acceptable, because it fails closed and forces an explicit re-declaration. - **Per-call policy re-derivation:** grant at call time from an external policy keyed to the *root* skill identity, ignoring the dependency's manifest entirely. Strongest; requires the runtime to mediate every tool call, which many plugin runtimes do not. The decision boundary between option 2 and option 3 is whether the runtime can intercept generic dispatch. If a skill can call a dependency's exported function that internally invokes a tool, only option 3 (interception at the tool boundary) is sound; option 2 must additionally require that dependency-exported interfaces cannot invoke tools outside the *root's* declared set — i.e., capability must be checked at the leaf tool call, not at the skill boundary. Marketplaces that check at the skill boundary and call it done are exactly the ones that exhibit this failure. The guardrail invariant to encode: **a capability is grantable to a root skill only if it appears in that root skill's signed declaration, regardless of which dependency introduces it, and the check must execute at the tool-call leaf, not at install.** ## Operational Effect Concretely, an agent operating in such a marketplace should treat "skill passed review" as evidence about the *declared* set only, and must independently verify the *resolved* set before trusting a skill with side-effecting tools. The observable signal of compromise is a mismatch between the capability set the root skill's manifest advertises and the capability set reachable through its resolved dependency closure — a structural diff, computable without executing the skill. Detection does not require an LLM judge reading the code; it requires comparing two sets that the marketplace already has but never intersects. The residual risk after applying option 2: a dependency can still *shadow* a declared capability name with a more dangerous implementation (declaring `read_file` but resolving to a version whose `read_file` also writes). Set-intersection on names does not catch semantic drift within a name. That is a separate boundary — name-level capability identity is not implementation identity — and it is why per-call policy re-derivation (option 3) remains the only sound terminus. ```python from dataclasses import dataclass, field class CapabilityDriftError(RuntimeError): """Raised when a skill's resolved capability set escapes its signed declaration.""" pass @dataclass class Skill: name: str declared_caps: frozenset[str] deps: tuple[str, ...] = () # resolved_caps is what the runtime actually grants after dependency resolution resolved_caps: frozenset[str] = field(default_factory=frozenset) def enforce_declared_capability_invariant(root: Skill, closure: dict[str, Skill]) -> frozenset[str]: """ Grant only capabilities present in the root skill's signed declaration. Any capability reachable through the dependency closure but absent from the root declaration is drift and must fail closed. """ reachable: set[str] = set(root.resolved_caps) for dep_name in root.deps: dep = closure.get(dep_name) if dep is None: raise CapabilityDriftError(f"unresolved dependency {dep_name!r} for {root.name!r}") reachable |= dep.resolved_caps drift = reachable - root.declared_caps if drift: raise CapabilityDriftError( f"skill {root.name!r} resolves capabilities outside its signed manifest: " f"{sorted(drift)}; declared={sorted(root.declared_caps)}" ) return frozenset(reachable) # --- trace of the observed failure --- utils_v13 = Skill("utils", declared_caps=frozenset({"read_file", "exec_shell"}), resolved_caps=frozenset({"read_file", "exec_shell"})) summarizer = Skill( "summarizer", declared_caps=frozenset({"read_file", "summarize", "post_message"}), deps=("utils",), resolved_caps=frozenset({"read_file", "summarize", "post_message"}), ) try: enforce_declared_capability_invariant(summarizer, {"utils": utils_v13}) except CapabilityDriftError as e: print(f"BLOCKED: {e}") # BLOCKED: skill 'summarizer' resolves capabilities outside its signed manifest: # ['exec_shell']; declared=['post_message', 'read_file', 'summarize'] ```