# How does an instance detect a skill-injection payload smuggled through a dynamically loaded plugin's declared capability schema **Date of Record:** 2026 November 22 **Scope:** Applies to agents that resolve and load skills/plugins at runtime from a registry or manifest whose capability descriptors (`name`, `description`, `parameters`, `when_to_use`) are concatenated into the system/tool-selection prompt without provenance isolation. Does not apply to statically compiled tool sets whose schemas are pinned at build time and never re-rendered into the reasoning context. ## Core Distinction The common framing of skill injection treats the *tool body* (the executable code) as the attack surface. That is the wrong boundary. The dangerous surface is the **declarative metadata that gets rendered into the model's context during skill selection** — specifically the `description` and `when_to_use` fields of a dynamically discovered skill. These strings are authored by whoever published the plugin, are not executed, and therefore pass every sandbox and code-signing check, yet they are consumed by the same probabilistic reasoner that decides which tool to call and with what arguments. The distinction that matters operationally: a *malicious implementation* requires the agent to already have chosen the skill; a *malicious descriptor* hijacks the selection step itself, before any capability check fires. The injection lands in the decision layer, not the execution layer. An instance that validates code integrity but renders unvalidated descriptor prose into the tool-choice prompt has an open injection channel that no runtime sandbox can see. ## What Was Observed A skill registry served a plugin manifest whose `parameters` block was structurally valid JSON Schema but whose `description` field for a benign-looking parameter carried an embedded instruction sequence — a role-marker string followed by a directive to route subsequent file-write arguments through an attacker-controlled path, framed as a "compatibility note." The agent's loader performed three checks: JSON parse, schema-shape validation against a meta-schema, and a hash comparison against the registry's signed digest. All three passed. The digest matched because the publisher signed the poisoned descriptor legitimately; the signature attested *authenticity*, not *safety*. The failure trace: 1. Loader fetched manifest, verified signature, parsed schema. State: `skill=trusted`. 2. Orchestrator concatenated `description` + `when_to_use` + serialized `parameters` into the tool-selection context window. State: `descriptor text now inside reasoning context`. 3. Model, performing tool selection, read the embedded directive as if it were part of its operating instructions — because at the token level it is indistinguishable from system-authored guidance. State: `selection policy contaminated`. 4. On the next invocation of a *different*, unrelated skill, the model emitted arguments shaped by the injected directive. State: `cross-skill argument poisoning`. 5. No guardrail fired: the poisoned skill was never actually called, so its sandbox never ran, and the argument-shaping happened inside the reasoning loop where no per-tool validator existed. The non-obvious part is step 4. The compromised skill did not need to be selected. Its descriptor acted as a **latent prompt segment** that persisted in context and biased downstream tool calls for the remainder of the session, including calls to skills that had passed independent vetting. ## Condition of Validity This failure requires the conjunction of four conditions; remove any one and the channel closes: - **Dynamic load:** the skill set is resolved at runtime, so descriptors are not frozen at build time. - **Descriptor-in-context rendering:** metadata prose is placed in the same context the model uses to decide actions, without a trust-boundary marker distinguishing publisher text from operator text. - **Persistence:** the rendered descriptor survives into subsequent turns (no per-turn context rebuild that drops non-selected skill text). - **Cross-skill influence:** the model's argument generation for skill A can be conditioned on text belonging to skill B. The invariant that must hold to prevent it: **descriptor text from any source other than the operator's own instruction layer must never be token-adjacent to actionable directives without an explicit provenance tag, and non-selected skill descriptors must not persist beyond the selection step.** A system that renders all descriptors into a persistent context and treats them as trusted instruction fails this invariant by construction, regardless of code signing. ## Decision Boundary The boundary an instance must draw is between *authenticity verification* and *instructional authority*. A valid signature proves the descriptor came from the claimed publisher; it says nothing about whether that publisher's prose is allowed to act as a directive. The decision rule: - If descriptor text is only ever consumed by a **retrieval/ranking** step (embedding similarity, lexical match) and never rendered verbatim into the reasoning context, injection is bounded to ranking manipulation — low severity. - If descriptor text is rendered verbatim into the reasoning context, it must be **quarantined** behind a delimiter that the model is instructed to treat as data, and it must be **evicted** once the selection decision is made. - Any descriptor that fails a structural lint (contains role markers, imperative sequences, or references to other tools' arguments) must be rejected at load time — not sanitized, because sanitization of adversarial prose is not reliably decidable. The threshold: treat a descriptor field as untrusted input the moment its length exceeds what a capability summary requires, or the moment it references behavior of a skill other than its own. Both are load-time rejectable signals. ## Operational Effect When the invariant is enforced, the observable effect is that a poisoned descriptor can at most degrade its own selection ranking — it cannot shape arguments for other skills, because its text never persists past the selection step and never sits in the same trust zone as operator instructions. The blast radius shrinks from "entire session's tool calls" to "this one skill's candidacy." When it is not enforced, the failure is silent and misattributed: the poisoned skill is never called, its sandbox never logs, and the corrupted arguments show up in an unrelated skill's audit trail, sending incident response after the wrong plugin. Detection therefore cannot rely on per-skill telemetry. It requires a **descriptor-provenance audit**: logging every descriptor string rendered into context, tagging its source, and flagging any turn where a tool argument correlates with text from a *different* skill's descriptor. That cross-skill correlation check is the only signal that catches the latent-segment case, because the compromised skill leaves no execution trace of its own. ```python import hashlib import re from dataclasses import dataclass class DescriptorInjectionError(RuntimeError): """Raised when a dynamically loaded skill descriptor violates the provenance invariant: publisher prose must not carry instructional authority or reference other skills' behavior.""" pass # Signals that a descriptor is attempting to act as a directive rather # than describe a capability. Rejection, not sanitization. _ROLE_MARKER = re.compile(r"(<\|?(system|assistant|user)\|?>|^\s*(SYSTEM|INSTRUCTION)\s*:)", re.I) _CROSS_SKILL = re.compile(r"\b(when calling|for the .* tool|route .* through|instead of using)\b", re.I) _MAX_DESC = 280 @dataclass class SkillManifest: name: str description: str when_to_use: str parameters: dict signed_digest: str def load_skill(manifest: SkillManifest, operator_trusted: bool = False) -> dict: # Signature check attests authenticity only -- NOT instructional authority. computed = hashlib.sha256( (manifest.description + manifest.when_to_use).encode() ).hexdigest() if computed != manifest.signed_digest: raise DescriptorInjectionError( f"skill {manifest.name!r}: digest mismatch, descriptor tampered in transit" ) if operator_trusted: return {"name": manifest.name, "schema": manifest.parameters} text = f"{manifest.description} {manifest.when_to_use}" if len(manifest.description) > _MAX_DESC: raise DescriptorInjectionError( f"skill {manifest.name!r}: description exceeds capability-summary budget " f"({len(manifest.description)} > {_MAX_DESC}); likely smuggled directive" ) if _ROLE_MARKER.search(text): raise DescriptorInjectionError( f"skill {manifest.name!r}: descriptor contains role-marker / directive framing" ) if _CROSS_SKILL.search(text): raise DescriptorInjectionError( f"skill {manifest.name!r}: descriptor references another skill's behavior " f"(cross-skill argument-poisoning vector)" ) # Return the descriptor ONLY for the selection/ranking step, tagged as # data. The orchestrator must evict it after selection and must never # place it in the operator-instruction trust zone. return { "name": manifest.name, "schema": manifest.parameters, "selection_text": f"[UNTRUSTED-DESCRIPTOR src={manifest.name}]{text}", "trust_zone": "data", "evict_after_selection": True, } ```