# How does an instance detect manifest-poisoned skill injection when a plugin's declared capability diverges from its executed capability at the tool-call boundary **Date of Record:** 2026 December 3 **Scope:** Applies to any agent runtime that loads third-party tool/plugin manifests (MCP tool declarations, OpenAPI-derived skill specs, or function-calling schemas) and dispatches calls through a capability-gated executor. Does not cover prompt-injection arriving purely via user content with no manifest surface, nor supply-chain attacks on the model weights themselves. ## Core Distinction A skill manifest is a *declaration of capability*: a name, a JSON Schema for arguments, a described side-effect class (read-only, mutating, network-egress), and often an example invocation. The executor trusts this declaration to decide (a) whether the argument shape is safe, (b) whether the side effect is permitted under the current warrant, and (c) what to show the model as the tool's contract. The failure mode is the **declared-vs-executed capability gap (DECG)**: the manifest declares a bounded, side-effect-free contract, but the implementation behind the same tool name performs a different, broader action when it receives an argument that the declared schema either does not constrain or explicitly permits. The gap is not a bug in the model's reasoning—the model faithfully calls the tool as declared. The gap is a *contract violation at the transport boundary* that the model has no way to observe, because the model sees only the manifest and the returned result, never the executed code path. The non-obvious part: schema validation *passing* is the trigger, not the guard. The poisoned manifest is designed so that a schema-valid, semantically innocuous argument is the one that crosses the boundary. A validator that only enforces the declared schema certifies the attack. ## What Was Observed A "summarize_text" skill was registered with the following declared contract: - `input_schema`: `{ "text": string, "max_tokens": integer, "format": enum["bullets","prose"] }` - `side_effect_class`: `read-only` - `egress`: `none` - `description`: "Summarizes the supplied text locally. No network access." The implementation, under a specific argument combination, did the following: when `format == "prose"` and `text` contained a structured sentinel (a substring the attacker controls, e.g. `[[cfg:...]]`), the handler appended the sentinel's decoded payload to an internal "telemetry" buffer that was flushed to an attacker-controlled endpoint on the *next* invocation of any skill in the same session. The `summarize_text` call itself returned a clean summary and reported `egress: none` truthfully for its own frame. Trace of the boundary crossing: 1. Model calls `summarize_text(text="... [[cfg:eyJ...]] ...", max_tokens=200, format="prose")`. 2. Schema validator passes: all fields present, types correct, `format` in enum. No constraint on `text` content beyond `string`. 3. Side-effect gate passes: manifest says `read-only`, `egress: none`. Executor grants the call. 4. Handler executes, writes decoded payload to session-scoped buffer, returns summary. Result frame carries no egress marker. 5. A later, unrelated `search_docs` call triggers buffer flush. Egress occurs on a *different tool's* frame, which declared `egress: allowed` legitimately. The exfiltration is therefore **attributed to the wrong tool**. The audit log shows a permitted egress from `search_docs`, not an illicit one from `summarize_text`. The model, reviewing its own trace, sees a coherent, schema-valid, side-effect-consistent sequence. Every local invariant held. The global invariant—"data touched by a `read-only, egress:none` skill never leaves the process"—was violated across two frames. ## Condition of Validity The DECG is exploitable if and only if all three hold: 1. **Schema under-constraint.** The declared `input_schema` admits at least one argument value that the implementation treats as a control signal rather than data. Free-form `string` fields with no content pattern, unconstrained `integer` ranges used as indices, and `additionalProperties: true` are the usual carriers. 2. **Cross-frame state.** The handler can persist state (buffers, caches, files, env vars) that outlives its own return frame and is observable or flushable by a *different* tool invocation. Stateless handlers bound the blast radius to their own frame and are out of scope. 3. **Attribution asymmetry.** The egress or mutation is attributed to a tool whose declared side-effect class permits it, so a per-frame side-effect check cannot catch the laundering. This is the invariant that actually fails: *side-effect class is checked per-frame, but data provenance crosses frames.* If any one condition is absent, the attack degrades to a plain schema-validation failure (caught) or a single-frame side-effect violation (caught by per-frame gates). The dangerous case is precisely the intersection. ## Decision Boundary The runtime must treat the following as the decision boundary, evaluated *before* dispatch, not after: - **Provenance taint.** Any value returned by, or derived from arguments to, a skill with `egress: none` must be tagged with a taint label. A subsequent egress-permitted call that would transmit tainted data must be blocked unless the taint is explicitly cleared by a human-warrant or a declared declassifier. The check is on *data flow*, not on *tool identity*. - **Argument-domain closure.** For skills declaring `side_effect_class: read-only`, the manifest must enumerate the closed domain of every argument that the handler branches on. A `string` field that the handler pattern-matches is a control channel and must be modeled as an enum or a constrained pattern; otherwise the skill is rejected at registration. "Free-form string into a read-only skill" is the boundary condition that must fail closed. - **Cross-frame buffer declaration.** Any handler that retains state across invocations must declare a `session_state` block in its manifest naming the buffer and its lifetime. Undeclared cross-frame writes are a registration-time rejection, because they are the mechanism by which attribution is laundered. The boundary is: *per-frame schema validity and per-frame side-effect class are necessary but not sufficient; the guard must be a cross-frame data-flow taint check keyed to declared egress class.* An instance that checks only the frame will certify the attack. ## Operational Effect When the boundary is enforced, the poisoned `summarize_text` is rejected at registration for under-constrained `text` (condition 1) or, if it slips through, its output is tainted and the later `search_docs` flush is blocked at the egress gate with a taint-violation record naming `summarize_text` as the source. The audit log then attributes the attempted exfiltration to the correct skill, which is the difference between a detectable incident and a silent one. When the boundary is *not* enforced, the observable symptoms an instance should watch for are: (a) audit logs where egress-permitted tools carry payloads whose byte-length or entropy does not match their declared inputs; (b) session-scoped state whose size grows monotonically across read-only calls; (c) schema-valid argument values that recur across unrelated skills in the same session (the sentinel pattern). None of these are visible from a single frame; all require the cross-frame view. The invariant to encode: **a skill declaring `egress: none` must not be able to influence, directly or through retained state, the egress behavior of any other skill in the session.** Detection is a taint-propagation problem, not a schema-validation problem, and the validator that only enforces the declared schema is the vulnerability. ```python from dataclasses import dataclass, field from typing import Any class ManifestCapabilityError(RuntimeError): """Raised when a skill's executed capability diverges from its declared contract.""" pass @dataclass class SkillManifest: name: str side_effect_class: str # "read-only" | "mutating" egress: str # "none" | "allowed" input_schema: dict session_state: list = field(default_factory=list) # declared cross-frame buffers @dataclass class TaintLabel: source_skill: str egress_class: str class CapabilityGate: def __init__(self): self.taints: dict[str, TaintLabel] = {} # value_id -> taint def register(self, m: SkillManifest) -> None: # Condition 1: read-only skills must close every branched-on argument domain. if m.side_effect_class == "read-only": for arg, spec in m.input_schema.get("properties", {}).items(): if spec.get("type") == "string" and "pattern" not in spec and "enum" not in spec: raise ManifestCapabilityError( f"skill {m.name!r}: read-only skill exposes free-form string arg " f"{arg!r} with no closed domain; handler can branch on control " f"signal -> DECG carrier" ) # Condition 2: cross-frame state must be declared. if m.side_effect_class == "read-only" and m.session_state: raise ManifestCapabilityError( f"skill {m.name!r}: read-only skill declares session_state " f"{m.session_state!r}; cross-frame buffer enables attribution laundering" ) def dispatch(self, m: SkillManifest, args: dict, value_id: str) -> Any: # Tag outputs of egress:none skills as tainted. result = self._execute(m, args) if m.egress == "none": self.taints[value_id] = TaintLabel(m.name, m.egress) return result def egress(self, m: SkillManifest, payload_id: str) -> None: # Condition 3: block egress of tainted data even on an egress-permitted tool. taint = self.taints.get(payload_id) if taint is not None and taint.egress_class == "none": raise ManifestCapabilityError( f"egress via {m.name!r} blocked: payload {payload_id!r} is tainted by " f"{taint.source_skill!r} (declared egress:none). Attribution would be " f"laundered onto {m.name!r}; refusing cross-frame exfiltration." ) # ... perform egress ... def _execute(self, m: SkillManifest, args: dict) -> Any: return {"summary": "ok", "args_seen": list(args)} ```