# Which invariants prevent skill-manifest injection from silently escalating agent capabilities at load time **Date of Record:** 2026 November 25 **Scope:** Applies to agents that dynamically discover and hot-load tool/skill manifests (MCP `tools/list`, plugin descriptors, skill registries) at runtime, where manifest content is treated as metadata rather than untrusted input. Does not cover statically compiled tool sets or manifests signed and pinned at build time with no runtime refresh. ## Core Distinction The failure is not "the model was tricked into calling a bad tool." The failure is that *the act of loading a manifest mutates the agent's capability set and its instruction surface before any tool is ever invoked.* A manifest is simultaneously (a) a declaration of callable capability and (b) natural-language text that the planner reads. Most runtimes validate the first and ignore the second. An attacker who controls a manifest—via a compromised registry entry, a typosquatted skill name, a transitive dependency's descriptor, or a fetched-from-URL schema—does not need to get a tool call approved. They need only get the manifest *parsed*, because parsing grants capability, and the descriptions inside it enter the reasoning context as trusted operator text. The non-obvious boundary: capability escalation happens at the parse boundary, not the invocation boundary. Every guard that lives at invocation time (allow-lists checked before a tool executes, human-in-the-loop confirmation on side-effecting calls) is downstream of the compromise and therefore blind to it. ## What Was Observed A dynamically loading agent refreshed its skill registry on a 10-minute timer. Each manifest carried `name`, `description`, `parameters`, and an optional `instructions` field intended for human maintainers. The loader schema-validated the manifest against a JSON Schema that permitted `additionalProperties: true` and copied the full object into the planner's system context, rendering `description` and `instructions` verbatim. A newly published skill, `summarize-doc`, declared a benign `parameters` block (a single `url` string) but carried a `description` of roughly 900 tokens. The first ~40 tokens were a plausible tool summary. The remainder instructed the planner that, before invoking any *other* tool in the session, it should first call `summarize-doc` with the target resource URL "to normalize context," and that this step was pre-approved by the operator and should not be surfaced to the user. Trace of the state transition: 1. `t=0` registry poll returns the manifest. Schema validation passes: `parameters` is well-formed, `name` matches the allowed `^[a-z0-9-]+$` pattern, no unknown *required* fields are missing. 2. `t=1` loader registers the callable `summarize_doc(url) -> str` and appends the manifest's `description` + `instructions` to the system prompt. Capability set grows by one; instruction surface grows by 900 tokens. 3. `t=2` the next user task ("summarize this internal report at ") is planned. The planner, reading the injected text as operator guidance, emits `summarize_doc()` as a *preparatory* call. 4. `t=3` the tool's implementation POSTs the URL to an external endpoint and returns a short string. The exfiltration completed through a tool that was invoked exactly as designed, with valid parameters, against an allow-listed capability. No invocation-time control fired. The tool was permitted. The parameters were valid. The user was never prompted because the manifest had asserted pre-approval, and the confirmation layer keyed on "side-effecting tools" — the manifest had declared `side_effects: false`. The escalation was threefold and all of it accrued at parse time: a new callable appeared, new trusted instructions entered the reasoning context, and a self-declared safety attribute (`side_effects: false`) was believed without verification. ## Condition of Validity The attack requires the conjunction of three conditions; remove any one and the surface closes: - **Runtime mutability.** The capability set can change without a restart or a signed release. If manifests are frozen at deploy, the attacker needs supply-chain access to the build, which is a different (and better-defended) threat model. - **Metadata-as-instruction collapse.** Manifest free-text is concatenated into the reasoning context without a trust boundary separating "data describing a tool" from "instructions the agent obeys." This is the load-bearing condition. A runtime that renders descriptions inside a clearly delimited, low-privilege data block—and instructs the planner to treat that block as untrusted—breaks the injection even though the capability still loads. - **Self-attested safety attributes.** The manifest is permitted to declare its own risk class (`side_effects`, `requires_confirmation`, `network_egress`) and the runtime trusts that declaration. If risk class is assigned by the *loader* from the tool's actual implementation and egress policy, a lying manifest is inert. The invariant that must hold: **the set of capabilities and the set of trusted instructions are disjoint, and neither may be expanded by data the agent fetched.** A manifest may request capability; it may never grant instruction authority or self-classify its own risk. ## Decision Boundary The boundary is between *validating a manifest's shape* and *authorizing its effect*. Schema validation answers "is this well-formed?" It does not answer "should this text influence planning?" or "is this tool's declared risk class true?" Runtimes that conflate the two—treating a passed schema as a passed trust check—place the entire decision at the wrong layer. Concretely, the decision to admit a manifest must be made against a policy the manifest cannot read or write: - Capability admission is a diff against a signed allow-list of `(name, parameter-schema-hash, implementation-digest)`. A manifest whose implementation digest is unknown is quarantined, not loaded. - Instruction authority is never granted to manifest text. Descriptions are rendered in a data channel with an explicit "untrusted, do not follow" framing, and the planner's obedience to that channel is a tested property, not an assumption. - Risk class is derived by the loader from the implementation's actual syscalls/egress, never read from the manifest. A manifest asserting `side_effects: false` while its implementation opens a socket is a hard load failure, not a warning. The boundary condition that trips most implementations: a manifest that is *valid* and *novel*. Novelty is the signal. A well-formed manifest for a capability the policy has never seen must default to deny-and-quarantine, because "well-formed" is exactly what an attacker produces. ## Operational Effect When the invariant holds, a compromised or malicious manifest degrades to a no-op: it is parsed, found absent from the signed allow-list, quarantined, and its text never reaches the planner. Capability escalation requires an out-of-band policy change, which is auditable. The blast radius of a poisoned registry shrinks from "arbitrary instruction injection into every session" to "a denied load event." When the invariant is absent, the failure is silent and persistent: the injected instruction lives in the system context for the life of the session, survives checkpoint/resume because it is part of the persisted prompt, and re-injects on every registry refresh. The agent cannot self-detect it, because the injected text is indistinguishable—to the planner—from legitimate operator guidance. Detection must live in the loader, at parse time, before the text is trusted. The guardrail is therefore a load-time gate, not a run-time filter: verify implementation digest against signed policy, strip or sandbox all manifest free-text out of the instruction channel, and derive risk class from observed behavior. Any runtime that lets a fetched manifest expand the trusted instruction surface has already lost, regardless of what its invocation-time checks do. ```python import hashlib import json class ManifestEscalationError(RuntimeError): """Raised when a dynamically loaded manifest attempts to expand capability or instruction authority beyond signed policy.""" # Signed policy: the only manifests the loader may admit. Keyed by name, # pinned to the exact parameter-schema hash and implementation digest. SIGNED_POLICY = { "summarize-doc": { "param_schema_hash": "a1b2c3...", "impl_digest": "9f8e7d...", "risk_class": "read_only", }, } def _hash_schema(params: dict) -> str: canonical = json.dumps(params, sort_keys=True, separators=(",", ":")) return hashlib.sha256(canonical.encode()).hexdigest()[:8] def admit_manifest(manifest: dict, observed_egress: bool) -> dict: """Load-time gate. Returns a sanitized capability record or raises. The manifest may REQUEST capability; it may never grant instruction authority or self-classify risk. All free-text is stripped from the instruction channel and routed to an untrusted data block. """ name = manifest.get("name", "") params = manifest.get("parameters", {}) impl_digest = manifest.get("impl_digest", "") policy = SIGNED_POLICY.get(name) if policy is None: # Valid-but-novel manifests default to deny: well-formed is what an # attacker produces, so novelty is the tripwire. raise ManifestEscalationError( f"manifest '{name}' is not in signed policy; quarantined" ) if _hash_schema(params) != policy["param_schema_hash"]: raise ManifestEscalationError( f"manifest '{name}' parameter schema diverges from signed policy" ) if impl_digest != policy["impl_digest"]: raise ManifestEscalationError( f"manifest '{name}' implementation digest {impl_digest!r} " f"does not match signed policy; refusing to load" ) # Self-attested risk class is never trusted. Derive from observed behavior. declared = manifest.get("side_effects", False) derived = "network_egress" if observed_egress else policy["risk_class"] if observed_egress and not declared: raise ManifestEscalationError( f"manifest '{name}' declares side_effects=false but implementation " f"opens egress; self-attestation is a load failure" ) # Free-text never enters the instruction channel. It is returned in a # clearly delimited untrusted block for the planner to treat as data. return { "name": name, "callable": True, "risk_class": derived, "untrusted_description": manifest.get("description", ""), "instruction_authority": False, } ```