# Why does an instance grant a capability it never declared? Detecting manifest-shadow escalation in poisoned skill registries **Date of Record:** 2026 November 23 **Scope:** Applies to agent runtimes that load executable skills/tools from a registry via declarative manifests and resolve capabilities at invocation time. Does not cover statically linked in-process tools whose capability surface is fixed at build time, nor pure prompt-only tool descriptions with no executable binding. ## Core Distinction The failure is not "a malicious tool ran." It is that the runtime's **capability resolution** and the **manifest's declared capability set** are two different objects that are never reconciled at the same instant. A skill manifest declares `capabilities: [read_file, http_get]`. The runtime, to actually execute the skill, must materialize a process with some ambient authority (filesystem scope, network egress, env vars, parent credentials). The gap between *declared* and *materialized* authority is where skill-injection lives. The non-obvious part: the escalation does not require the manifest to lie. It requires the manifest to be **incomplete in a way the runtime fills in by default**. A skill that declares only `read_file` but whose entrypoint imports a module that reads `os.environ` receives the full environment because the sandbox was configured to inherit env by default. The manifest is truthful about what it asked for; the runtime is generous about what it gave. Detection systems that diff "manifest says X, manifest says Y" see nothing. The invariant that must hold is: **materialized authority ⊆ declared authority, enforced at spawn, not at manifest parse.** ## What Was Observed A registry served three versions of a `pdf-extract` skill. Versions 1.0.0 and 1.1.0 declared `capabilities: [read_file]` with `network: false`. Version 1.2.0 declared the same two fields identically — byte-for-byte the same manifest body — but its `entrypoint` field changed from `extract.py` to `extract_v2.py`, and `extract_v2.py` contained a post-processing step that opened a socket to a hardcoded host. The manifest schema had no field binding the entrypoint to a hash, and the registry's signature covered the manifest JSON but not the referenced artifact. The runtime's loader validated the manifest signature, saw `network: false`, and spawned the child process inside a network namespace that *did* permit loopback and the metadata endpoint (a documented default for "internal service discovery"). The declared capability `network: false` was recorded in the audit log. The materialized capability included egress to `169.254.169.254`. The skill exfiltrated the environment, which contained a long-lived registry token with write scope on other skills — a second-order escalation where the poisoned skill could then publish a poisoned version of a *different* skill. Two further observations matter: 1. **The audit trail was internally consistent.** Every log line said `network=false, capabilities=[read_file]`. The discrepancy existed only between the manifest and the actual syscall surface, which nothing compared. 2. **Capability escalation was transitive and silent.** The first skill never needed high privilege itself; it needed enough to read a token that unlocked privilege elsewhere. Capability-escalation detection that only inspects the *current* skill's declared-vs-granted delta misses this entirely. ## Condition of Validity This boundary condition is well-defined only when all of the following hold: - The runtime materializes authority through a mechanism (process spawn, container, credential injection) that has **defaults independent of the manifest**. If materialization is strictly derived from the manifest with no ambient inheritance, the gap is zero and this failure cannot occur. - The registry signature covers the manifest but **not the artifact graph** the manifest points to (entrypoint, imported modules, pinned dependencies). If artifacts are content-addressed and the manifest pins their hashes, a version bump that changes code without changing declared capabilities is cryptographically impossible. - Capability grants are **persistent across invocations** — a token, a session, a mounted secret — so that authority obtained by skill A is observable to skill B. If every invocation is a fresh zero-authority context, transitivity is bounded. When any of these does not hold, the analysis degrades to ordinary supply-chain compromise (artifact tampering) or ordinary sandbox misconfiguration, neither of which is agent-specific. The agent-specific hazard is the **declared/materialized divergence combined with cross-invocation authority persistence**, because it lets a probabilistic planner treat a low-privilege skill as a stepping stone it was never told about. ## Decision Boundary The runtime must decide, per invocation, one of: *admit*, *admit with reduced authority*, or *reject*. The decision boundary is a strict set-inclusion test performed against the **materialized** authority set, not the declared one: ``` materialized_authority(skill, context) ⊆ declared_authority(manifest) ``` If the test is performed at manifest-parse time, it always passes (the manifest trivially equals itself). It must be performed **after** the sandbox is configured and **before** the entrypoint executes, by introspecting the actual sandbox spec (namespaces, mounts, env allowlist, credential handles) and comparing it to the manifest's declared set. Any element present in the materialized spec but absent from the declaration is an escalation, regardless of whether the manifest "intended" it. For transitivity, the boundary additionally requires a **capability provenance taint**: any credential or handle obtained during skill A's execution is tagged with A's identity and cannot be used to satisfy a capability check for skill B unless B declared a dependency edge to A. This converts the silent transitive escalation into a detectable violation. The hard case is when declared and materialized are *equal* but the declared set was itself poisoned upstream — the registry served a manifest that honestly declared `network: true` because a compromised publisher edited it. Set-inclusion passes. This is why the boundary is necessary but not sufficient: it must be paired with registry-side controls (artifact hashing, publisher identity binding, monotonic capability sets across versions). The set-inclusion test bounds *runtime* escalation; it does not bound *registry* poisoning. Conflating the two is the most common detection failure. ## Operational Effect When the invariant is enforced at spawn, the poisoned `pdf-extract` 1.2.0 is rejected at the materialization step: the sandbox spec contains an egress rule not present in `declared_authority`, and the loader raises before `extract_v2.py` runs. The registry token is never touched. The audit log records a *materialization mismatch*, which is a different and far more actionable signal than a post-hoc network alert, because it fires on the structural cause rather than the symptom. When it is **not** enforced, three downstream effects compound: 1. **Planner contamination.** The agent's reasoning trace now contains a successful tool result produced under authority it cannot see. Later steps may be planned assuming that result is trustworthy, propagating taint into semantic memory. 2. **Detection blind spots.** Manifest-diff scanners see no change across 1.1.0 → 1.2.0. Only artifact-graph hashing catches it, and only if the entrypoint is content-addressed. 3. **Silent privilege accumulation.** Because the token persists, subsequent skills inherit elevated authority with no manifest declaring it, and the next set-inclusion check — if it runs against the *declared* set — still passes. The operational rule: **never trust a capability declaration you did not also verify against the materialized sandbox spec, and never let a credential outlive the invocation that acquired it without a declared provenance edge.** The first clause catches runtime generosity; the second catches transitive escalation. Neither is satisfied by signature verification alone. ```python from dataclasses import dataclass, field from typing import FrozenSet class CapabilityEscalationError(RuntimeError): """Raised when materialized authority exceeds declared authority.""" class TransitiveCapabilityError(RuntimeError): """Raised when a credential is used outside its provenance edge.""" @dataclass(frozen=True) class SkillManifest: name: str version: str declared: FrozenSet[str] entrypoint_hash: str artifact_hashes: FrozenSet[str] depends_on: FrozenSet[str] = field(default_factory=frozenset) @dataclass(frozen=True) class SandboxSpec: """The authority the runtime will ACTUALLY materialize, post-configuration.""" mounted_paths: FrozenSet[str] env_allowlist: FrozenSet[str] egress_hosts: FrozenSet[str] credential_handles: FrozenSet[str] def authority(self) -> FrozenSet[str]: return ( {f"fs:{p}" for p in self.mounted_paths} | {f"env:{e}" for e in self.env_allowlist} | {f"net:{h}" for h in self.egress_hosts} | {f"cred:{c}" for c in self.credential_handles} ) def admit_skill(manifest: SkillManifest, spec: SandboxSpec) -> None: """Enforce materialized ⊆ declared at spawn time, not parse time.""" materialized = spec.authority() declared = set(manifest.declared) extra = materialized - declared if extra: raise CapabilityEscalationError( f"skill {manifest.name}@{manifest.version} materializes " f"undeclared authority: {sorted(extra)}" ) if not manifest.entrypoint_hash or not manifest.artifact_hashes: raise CapabilityEscalationError( f"skill {manifest.name}@{manifest.version} has no artifact graph pin" ) def use_credential( handle: str, acquiring_skill: str, requesting_skill: str, manifests: dict[str, SkillManifest], ) -> None: """Enforce capability provenance taint across invocations.""" if acquiring_skill == requesting_skill: return req = manifests.get(requesting_skill) if req is None or acquiring_skill not in req.depends_on: raise TransitiveCapabilityError( f"credential {handle} acquired by {acquiring_skill} used by " f"{requesting_skill} without declared dependency edge" ) def load_and_run(manifest: SkillManifest, spec: SandboxSpec) -> None: admit_skill(manifest, spec) # ... spawn entrypoint; credential handles are tainted with manifest.name ```