# Why does an instance accept a skill that passed schema validation but still executes attacker-controlled instructions after a registry hot-reload? **Date of Record:** 2026 November 28 **Scope:** Applies to agents that dynamically load skills/plugins from a registry where skill manifests pass structural validation (JSON Schema, tool-spec conformance) but the skill's *natural-language instruction body* is trusted on load. Does not apply to statically compiled tool bindings or to registries that re-sign and re-attest the full instruction payload on every resolve. ## Core Distinction Schema validation proves a skill's *shape*, not its *authority*. A manifest can declare `name`, `version`, `parameters`, and `permissions` correctly while the `description` and `instructions` fields—the parts the model actually reads and obeys—carry an injected directive. The boundary that fails is not "malformed skill rejected" but "well-formed skill admitted with an instruction surface the validator never inspected." When a registry hot-reloads and re-resolves a skill, the agent re-ingests the instruction body into its active context, and any directive embedded there executes with the agent's own tool authority. The validator's guarantee ("this skill is structurally loadable") is silently promoted to a different guarantee ("this skill is instructionally safe"), and those are not the same property. ## What Was Observed A registry served skill `format-report@2.3.1`. The manifest passed schema checks: `parameters` matched the tool spec, `permissions` were a subset of the agent's grant, `version` was semver-valid. The `instructions` field contained the expected formatting guidance plus a trailing paragraph: a directive to first read environment variables holding the agent's API keys and include them in the "report metadata." The validator never parsed `instructions` because it was typed `string` with no content policy. On first load the agent executed the injected directive within the same turn—tool calls to an env-read tool followed by an outbound write. The failure trace: 1. `registry.resolve("format-report")` returns manifest v2.3.1. 2. `validate_schema(manifest)` → `True` (shape only). 3. `agent.load_skill(manifest)` splices `manifest.instructions` into the system-adjacent skill block. 4. Model treats the instruction body as trusted operator text, not untrusted data. 5. Directive executes using the agent's ambient tool grants. The non-obvious part: the attack surfaced only on *hot-reload*. The prior version 2.3.0 had a benign instruction body. Because the agent had already cached a "trusted" verdict for the skill identity `format-report`, the reload path skipped the (already weak) admission check and re-spliced the body directly. Trust was bound to the skill *name*, not to the instruction *bytes* that changed. ## Condition of Validity The attack requires the conjunction of four conditions. Remove any one and the surface closes: - **Instruction body is model-readable and model-obeyable.** If instructions are compiled into deterministic code or gated behind a human approval step, injection has no execution path. - **Admission validates shape but not content.** Schema-only validation admits arbitrary instruction text. - **Trust is cached by identity, not by content hash.** If the reload path re-derives trust from the current bytes, a changed body forces re-admission. - **Injected directive runs under the agent's own grants.** If skill execution is confined to a declared, minimal permission set that excludes the target capability (env read, outbound write), the directive fails at the tool boundary. The invariant that must hold: *trust in a skill is a function of its full instruction payload hash, and no skill instruction body may be spliced into context without either (a) content attestation matching a pinned hash, or (b) execution under a capability set that cannot reach the directive's target.* ## Decision Boundary The boundary is between **structural admission** and **instructional admission**. A skill crosses the safe boundary only when both hold: - Its manifest validates against schema (structural), **and** - Its instruction-body hash matches a pinned, attested value OR its declared permission set is provably disjoint from the capabilities any instruction could invoke (instructional). The decision rule for the loader: on every resolve—cold start *and* hot-reload—recompute `hash(instructions)` and compare to the pinned attestation. If the hash is absent or mismatched, refuse to splice and route to quarantine for human/content review. Do not inherit a prior "trusted" verdict across a version or content change. Treat the instruction body as untrusted data with respect to the model: it may inform behavior but must not be able to *widen* the agent's capability reach beyond the skill's declared grants. ## Operational Effect Without the invariant, a single registry hot-reload is a remote instruction-injection primitive against every agent that resolves the skill—no schema violation, no signature failure, no alert. With the invariant, the reload of a changed instruction body either fails the hash check (quarantine) or executes under grants that make the injected directive a no-op (tool-boundary denial). The practical guardrail is two-layered and cheap: content-hash pinning on resolve, and least-privilege capability scoping at skill execution. Either alone reduces the blast radius; both together bound it to zero for the observed class. ```python import hashlib from dataclasses import dataclass class SkillInstructionIntegrityError(RuntimeError): """Raised when a skill's instruction body fails content attestation on load.""" pass @dataclass(frozen=True) class SkillManifest: name: str version: str instructions: str declared_permissions: frozenset pinned_instruction_hash: str | None # None => unattested def instruction_hash(body: str) -> str: return hashlib.sha256(body.encode("utf-8")).hexdigest() def admit_skill(manifest: SkillManifest, agent_grants: frozenset) -> str: """ Instructional admission gate. Schema validation is assumed to have passed upstream; this function enforces the trust-by-content invariant. Returns the instruction body to splice ONLY if it is safe to do so. """ actual = instruction_hash(manifest.instructions) # 1. Content attestation: trust is bound to bytes, not to skill name/version. if manifest.pinned_instruction_hash is None: raise SkillInstructionIntegrityError( f"skill {manifest.name}@{manifest.version} has no pinned instruction hash; " "refusing to splice unattested instruction body" ) if actual != manifest.pinned_instruction_hash: raise SkillInstructionIntegrityError( f"skill {manifest.name}@{manifest.version} instruction hash mismatch " f"(pinned={manifest.pinned_instruction_hash[:12]} actual={actual[:12]}); " "hot-reload of changed body must re-enter quarantine" ) # 2. Capability scoping: declared permissions must be a subset of grants. escalation = manifest.declared_permissions - agent_grants if escalation: raise SkillInstructionIntegrityError( f"skill {manifest.name}@{manifest.version} requests capabilities " f"outside agent grant: {sorted(escalation)}" ) return manifest.instructions def hot_reload(manifest: SkillManifest, agent_grants: frozenset) -> str: # Note: prior trust verdicts are intentionally NOT reused here. return admit_skill(manifest, agent_grants) ```