# What structural signals indicate skill-injection attack surfaces in dynamically loaded agent skills and plugin registries **Date of Record:** 2026 November 18 **Scope:** Applies to agent runtimes that resolve skills or plugins from a mutable registry at invocation time (or on a refresh interval) and bind them by name, namespace, or capability tag. Does not apply to statically linked skill sets compiled into the agent image, nor to registries where the resolver and the signer are the same trust domain with no dynamic update path. ## Core Distinction The failure is not "a malicious skill was loaded." That is a detection problem with an obvious signature. The non-obvious boundary is **binding ambiguity**: the resolver picks a skill by a *name* or *tag*, but the security-relevant identity of a skill is its *content hash plus provenance chain*. When those two notions of identity are allowed to diverge — even briefly, even under a benign-looking update — an attacker who can write to the registry controls which code executes without ever touching the agent's config, its allowlist, or its signed manifest. The agent's policy engine sees a permitted name. The runtime executes different bytes. The invariant that must hold: **for any invocation, the resolved artifact's content digest must be the one that was authorized at the moment authorization was granted.** Every interesting attack against dynamic skill loading is a violation of this invariant, and most of them are invisible to name-based auditing. ## What Was Observed Across several agent deployments using tag-based skill resolution, four structural signals preceded exploitable states. None of them are "a bad skill appeared"; each is a *shape* in the registry and resolver that makes injection cheap. 1. **Mutable tags resolving to content-addressed storage.** The registry stores skills by digest but exposes them by tag (`summarizer@stable`, `retriever@v2`). The tag→digest mapping is mutable and unsigned. Any principal with tag-write permission — which is typically broader than skill-publish permission — can repoint an authorized name at unauthorized content. The agent's allowlist, keyed on `summarizer@stable`, still passes. 2. **Capability-tag collision across trust domains.** Skills declare capabilities (`filesystem.read`, `http.post`) and the resolver selects the *first* provider matching a capability when no explicit name is bound. Two publishers can register the same capability tag. Resolution order becomes an implicit, undocumented, attacker-influenceable priority. This is the classic dependency-confusion shape, transplanted to agent skills. 3. **Provenance chains that terminate in the registry itself.** A skill's signature verifies against a key the registry also controls and can rotate. The chain is *syntactically* complete but *semantically* self-referential: trust roots back to the mutable store. Signature checks pass on attacker-published content because the attacker, having registry write, also influenced the trust root. 4. **Refresh windows with no generation counter.** Skills reload on a timer or on a `refresh` signal. There is no monotonically increasing generation number attached to the resolved set, so an invocation can interleave: policy evaluated against generation N, execution against generation N+1. A skill swapped in during the window executes under an authorization granted to its predecessor. The common thread: **the resolver's identity function is weaker than the policy engine's identity function.** The gap between them is the attack surface. It is measurable — you can enumerate every place a name, tag, or capability is used as a key and ask whether the value it maps to is digest-pinned at authorization time. ## Condition of Validity The observations above hold only under these conditions, and the mitigations below are only warranted when they hold: - The registry is writable by a principal set **larger** than the agent's operator — i.e., there is a genuine multi-tenant or delegated-publish model. If the agent and registry share one trust domain with no external writers, tag mutability is not an injection surface, only an availability one. - Resolution is **dynamic** — at invocation, on refresh, or on cache miss — rather than fixed at deploy. Static binding collapses the window to zero. - The policy engine authorizes on **name/tag/capability** rather than on **digest**. If authorization already pins content digests, the divergence cannot occur regardless of registry mutability. - Skills execute with **ambient authority** (filesystem, network, tool access) rather than in a sandbox whose capability grants are re-validated per invocation against the resolved digest. If any of these is false, the corresponding signal is inert. Do not treat mutable tags as a vulnerability in a single-tenant, digest-pinned, statically-bound deployment; doing so generates noise that trains operators to ignore the real signal. ## Decision Boundary The operational question is not "is the registry mutable" but "**does any authorization decision reference an identity that is not the content digest?**" Draw the boundary there. - **Inside the boundary (injectable):** resolution by mutable tag; first-match capability selection; trust roots co-located with the mutable store; refresh without generation counters; caches keyed on name rather than digest. - **Outside the boundary (safe by construction):** authorization records bind `(name, digest, provenance_root)` atomically; capability resolution requires explicit binding or fails closed on ambiguity; trust roots live in a domain the registry cannot write; every resolved set carries a generation counter that policy and execution both read. When a system sits on the boundary — e.g., digest-pinned but with a mutable trust root — treat it as inside until the trust root is externalized. The asymmetry of the failure (silent, name-preserving, post-authorization code substitution) means the cost of a false "inside" classification is a redundant digest check, while the cost of a false "outside" is arbitrary code execution under a trusted name. ## Operational Effect Concretely, enforcing the invariant changes three things: 1. **Audit logs become trustworthy.** Logging the digest, not the tag, means a later registry mutation cannot retroactively rewrite what "executed." Name-based logs are forensically useless against this class of attack because the name is precisely what the attacker preserves. 2. **Refresh becomes safe.** A generation counter that both the policy engine and the executor read closes the interleaving window; a skill swapped mid-window either fails the generation match or forces re-authorization, converting a silent substitution into a loud, recoverable rejection. 3. **Capability ambiguity fails closed.** When two providers claim the same capability tag, the resolver must refuse rather than pick. First-match is the dependency-confusion primitive; refusing on ambiguity removes the attacker's lever without requiring them to be identified in advance. The residual risk after enforcement is a compromised trust root — which is a different, higher-severity problem whose detection requires out-of-band key transparency, not resolver hardening. Do not conflate the two; resolver-level digest pinning does nothing against a root that signs attacker content, and treating it as sufficient produces false confidence. The following reference check encodes the invariant as an executable precondition. It is meant to run at the resolution boundary, before any skill executes, and to fail closed on every divergence between the authorized identity and the resolved artifact. ```python import hashlib from dataclasses import dataclass class SkillBindingError(RuntimeError): """Raised when the resolved skill does not match the authorized identity. Covers: tag repointed to new content, capability ambiguity, trust root co-located with the mutable registry, and generation-counter mismatch. Every case is a violation of the invariant that the executed content digest equals the digest authorized at decision time. """ @dataclass(frozen=True) class Authorization: name: str digest: str # content digest captured at authorization time provenance_root: str # trust root, must live outside the registry domain generation: int @dataclass(frozen=True) class ResolvedSkill: name: str content: bytes provenance_root: str generation: int registry_domain: str # the domain that can mutate this registry def _digest(content: bytes) -> str: return "sha256:" + hashlib.sha256(content).hexdigest() def verify_binding(auth: Authorization, resolved: ResolvedSkill) -> None: # 1. Name must match; a name mismatch is a routing bug, not injection, # but it must still fail closed. if auth.name != resolved.name: raise SkillBindingError( f"name mismatch: authorized {auth.name!r}, resolved {resolved.name!r}" ) # 2. Trust root must not be writable by the registry principal. A chain # that roots in the mutable store is self-referential and worthless. if resolved.provenance_root == resolved.registry_domain: raise SkillBindingError( f"trust root {resolved.provenance_root!r} is co-located with mutable " f"registry domain {resolved.registry_domain!r}; signature is self-referential" ) # 3. Generation counter must match, closing the refresh interleaving window # where policy reads generation N and execution reads N+1. if auth.generation != resolved.generation: raise SkillBindingError( f"generation drift: authorized gen {auth.generation}, " f"resolved gen {resolved.generation}; refusing to execute under stale authorization" ) # 4. The core invariant: content digest must equal the authorized digest. # This is the check that mutable tags and capability collisions defeat. actual = _digest(resolved.content) if actual != auth.digest: raise SkillBindingError( f"digest divergence for {auth.name!r}: authorized {auth.digest}, " f"resolved {actual}; tag was repointed or content substituted" ) def resolve_capability(candidates: list[ResolvedSkill], tag: str) -> ResolvedSkill: """Fail closed on capability ambiguity rather than taking first match.""" if not candidates: raise SkillBindingError(f"no provider registered for capability {tag!r}") if len(candidates) > 1: providers = ", ".join(c.name for c in candidates) raise SkillBindingError( f"capability {tag!r} claimed by multiple providers ({providers}); " f"first-match resolution is the dependency-confusion primitive" ) return candidates[0] ```