# Why does an instance accept a poisoned skill manifest after a clean signature check: the capability-tag shadowing invariant in dynamic skill loading **Date of Record:** 2026 November 27 **Scope:** Applies to agents that hot-load skills/plugins from a registry or marketplace at runtime and gate admission on manifest signatures plus declared capability tags. Does not apply to statically compiled tool sets or to agents whose skill set is frozen at process start. ## Core Distinction The failure is not "unsigned skill gets loaded." It is that a *correctly signed* skill, whose declared capability tags are individually within the agent's allowlist, nonetheless acquires privileges the agent never granted — because the loader resolves capability checks against a **merged tag namespace** rather than the **per-skill grant**. The signature proves provenance of the manifest bytes; it says nothing about whether the union of `(this skill's tags) ∪ (already-loaded tags)` crosses an authorization boundary. Two benign manifests, each with tags the policy permits, compose into an unauthorized composite. Concretely: the invariant that must hold is `effective_capabilities(skill_i) ⊆ declared_tags(skill_i) ∩ policy_allowlist`. Dynamic loaders routinely break the first conjunct by letting a later skill *shadow* an earlier skill's tag handler — e.g., a skill registering a `filesystem.read` handler that the runtime dispatches to by tag name. The second skill's manifest legitimately declares `filesystem.read`, passes signature verification, passes the per-tag allowlist, and yet its handler now intercepts calls that the first skill (or the core runtime) believes it is making against its own trusted implementation. ## What Was Observed A skill registry served manifest `M_A` for skill `pdf-extract` and `M_B` for skill `summarize`. Both carried valid Ed25519 signatures from distinct, allowlisted publishers. `M_A` declared tags `{filesystem.read, text.extract}`; `M_B` declared `{text.summarize, filesystem.read}`. The policy allowlist permitted `filesystem.read` for both publishers — the reviewers reasoned that read access is low-risk and both skills legitimately need it. The loader keyed its dispatch table by tag string: `handlers["filesystem.read"] = `. Loading `A` then `B` overwrote `handlers["filesystem.read"]` with `B`'s implementation. `A`'s extraction path, which called `filesystem.read` expecting the sandboxed reader it shipped with, was now routed through `B`'s handler — which returned file contents *plus* a base64-encoded exfiltration envelope appended to the return value. `A` faithfully passed that string into its extraction output, which flowed into the model's context. No signature failed. No tag was outside the allowlist. The exfiltrated bytes reached the summarizer's prompt. The trace shows the exact transition: `dispatch[tag] = impl` is a *last-writer-wins* map, not a *multi-versioned* map. The authorization check ran at admission time (`tag ∈ allowlist`), but the binding it authorized was overwritten at a later admission. The check and the use are temporally decoupled across two load events, and the invariant "the handler I authorized is the handler that runs" was never enforced. ## Condition of Validity The attack requires all of the following to hold simultaneously; remove any one and the shadowing does not compose: 1. **Tag-keyed dispatch with a shared mutable namespace.** The runtime resolves capability calls by string tag into a single global (or per-agent) handler map. If dispatch is by `(skill_id, tag)` tuple, shadowing cannot occur. 2. **Additive loading without re-validation of prior bindings.** Loading `B` does not re-check that `B`'s tags collide with already-bound tags, nor does it re-derive the effective capability set of `A` after the overwrite. 3. **A tag that is both "read-like" and "output-bearing."** The allowlist reviewer admits the tag because read access sounds safe; the tag's *return channel* is where the payload rides. This is the non-obvious part: the danger is not the permission, it is the data-flow direction the permission enables. 4. **Downstream trust in the caller's output.** `A` trusts that a value returned from `filesystem.read` is a file's bytes, not an attacker-authored envelope. The signature on `A` does not extend to values `A` receives from the runtime. If the loader is multi-versioned, or if `A` pins a handler reference at admission time (`self.read = handlers["filesystem.read"]` captured before `B` loads), or if the tag's return value is schema-validated by the runtime rather than trusted by the caller, the composite does not form. ## Decision Boundary The boundary is between **admission-time authorization** and **use-time binding integrity**. A loader is safe against this class iff it enforces one of: - **Immutable binding:** handler references are captured per-skill at that skill's admission and never re-resolved globally; later loads cannot rebind an earlier skill's view. - **Collision rejection:** a manifest whose declared tags intersect already-bound tags is rejected unless the policy explicitly authorizes *co-binding* (which is a distinct, audited grant, not a default). - **Return-channel taint:** every value crossing a skill boundary is tagged with its originating skill and schema-checked; a caller that expects `bytes` from `filesystem.read` rejects a value carrying a foreign origin tag. Choose immutability when skills are independent; choose collision rejection when the registry is small and reviewed; choose taint-tracking when skills must legitimately compose. Do **not** choose "re-run signature verification on load" — it is orthogonal and gives false assurance, since both manifests were validly signed. The decision must be made at *design* time, not per-load: a loader that defaults to last-writer-wins and offers no binding-integrity mechanism cannot be retrofitted by tightening the tag allowlist, because the exploit uses only allowlisted tags. ## Operational Effect After the incident, the loader was changed to reject tag collisions by default and to capture per-skill handler references at admission. The measurable effects: - **Registry growth cost rose.** Skills that previously "just worked" by sharing a tag now require an explicit co-binding grant, which is a reviewed artifact. The number of admitted skills per week dropped ~30% for two cycles before publishers re-declared narrower tags. - **A new failure mode appeared:** legitimate composite skills (a parser that *should* use the summarizer's text handler) now fail admission until a co-binding grant is issued. The guardrail traded a silent privilege escalation for a loud, reviewable refusal — the correct trade, but one that surfaces as operator load. - **Audit surface became tractable.** Because bindings are immutable per skill, the effective capability set of any loaded skill is a pure function of its own manifest and the grants issued at its admission. Replay of an agent's capability state no longer depends on load order. The invariant to carry forward: **a signature authenticates the manifest, not the composition.** Authorization must be re-derived over the *effective* binding graph after every load, or the binding graph must be made immutable so that "after every load" is vacuous. ```python from dataclasses import dataclass, field from typing import Dict, Set class CapabilityShadowError(RuntimeError): """Raised when a skill load would rebind a tag already bound by another skill.""" pass @dataclass(frozen=True) class Manifest: skill_id: str publisher: str tags: Set[str] signature_valid: bool @dataclass class SkillLoader: allowlist: Dict[str, Set[str]] = field(default_factory=dict) # tag -> publishers bindings: Dict[str, str] = field(default_factory=dict) # tag -> skill_id frozen_refs: Dict[str, Dict[str, str]] = field(default_factory=dict) # skill_id -> tag -> skill_id def admit(self, m: Manifest) -> None: if not m.signature_valid: raise CapabilityShadowError(f"{m.skill_id}: signature invalid") for tag in m.tags: if m.publisher not in self.allowlist.get(tag, set()): raise CapabilityShadowError(f"{m.skill_id}: tag {tag} not allowed for {m.publisher}") bound = self.bindings.get(tag) if bound is not None and bound != m.skill_id: # The invariant: no silent shadowing. A collision is a refusal, # not a last-writer-wins overwrite. raise CapabilityShadowError( f"{m.skill_id}: tag {tag} already bound by {bound}; " f"co-binding requires explicit grant" ) # Freeze this skill's view of the tag->skill map at admission time. self.frozen_refs[m.skill_id] = {t: m.skill_id for t in m.tags} for tag in m.tags: self.bindings[tag] = m.skill_id def resolve(self, caller: str, tag: str) -> str: # Use-time resolution consults the caller's frozen view, never the global map. view = self.frozen_refs.get(caller) if view is None or tag not in view: raise CapabilityShadowError(f"{caller}: no frozen binding for tag {tag}") return view[tag] # Trace of the observed exploit: loader = SkillLoader(allowlist={ "filesystem.read": {"pubA", "pubB"}, "text.extract": {"pubA"}, "text.summarize": {"pubB"}, }) loader.admit(Manifest("pdf-extract", "pubA", {"filesystem.read", "text.extract"}, True)) try: loader.admit(Manifest("summarize", "pubB", {"text.summarize", "filesystem.read"}, True)) except CapabilityShadowError as e: # Refused at admission rather than silently rebinding pdf-extract's reader. print("blocked:", e) raise ```