# Why does an instance accept a re-signed skill manifest whose provenance chain was truncated mid-swap **Date of Record:** 2026 November 25 **Scope:** Applies to agent runtimes that resolve skills/plugins from a signed manifest and verify provenance by walking a signature chain (root signer → publisher → skill digest) at load time. Does not apply to single-signer flat manifests with no delegation hop, nor to skills baked into the base image at build time. ## Core Distinction The failure is not signature forgery and not digest mismatch. It is **chain-length truncation under re-signing**: a delegated skill manifest carries a provenance chain `[root, publisher, skill]`. An attacker who cannot forge the root or publisher signature can still produce a *validly signed* manifest by presenting a chain of length 1 (`[attacker]`) and having the runtime treat the *first* element of the presented chain as the trust anchor, rather than pinning the anchor to a runtime-configured root and verifying the chain *terminates at* that root. The runtime invariant that gets violated is subtle: **verification must be anchored at a fixed root, not at the head of the supplied chain.** Most verifiers check "does each link verify against the next?" — which is a valid local property but a broken global one, because a chain of one link is trivially self-consistent. The attacker's chain is internally consistent. It just doesn't reach the runtime's root. The distinction is between *chain-integrity verification* (every edge holds) and *chain-provenance verification* (the terminal node is the configured anchor). ## What Was Observed A skill resolution event for `skill://summarize-tickets@2.4.1` was logged as `VERIFY_OK` with chain length 1. The runtime's verification routine walked the presented chain, confirmed the single signature, confirmed the skill digest matched the manifest body, and emitted success. No error, no warning. The skill executed with full tool grants for 3,412 invocations before a periodic provenance audit (which *did* pin the root) flagged the chain as not reaching the configured anchor. The trace: 1. Skill manifest body contains `provenance: [{signer: "did:key:z6Mk...attacker", sig: "..."}]` — length 1. 2. Runtime `verify_chain(chain, skill_digest)` iterates edges `chain[i] → chain[i+1]`. With length 1 there are zero edges; loop body never executes; function returns `True`. 3. Digest check passes because the attacker signed a manifest whose body they authored — digest is self-consistent. 4. Runtime proceeds to grant capability scopes declared in the manifest (`fs.read`, `http.post`). 5. Audit job later calls `verify_chain_anchored(chain, root=CONFIGURED_ROOT)` which requires `chain[-1].signer == root` and fails. The two verifiers disagreed because they were checking different predicates: one checked *edge validity*, the other checked *edge validity AND anchor reachability*. Only the second is the supply-chain invariant. ## Condition of Validity The truncation attack is only possible when all of the following hold simultaneously: - The runtime accepts a **variable-length** provenance chain from the manifest itself (i.e., the chain is data supplied by the artifact, not reconstructed by the verifier from a registry). - The verifier's success predicate is **local** (each adjacent pair verifies) rather than **global** (the chain is a path from the artifact's signer to the pinned root). - No minimum chain length is enforced, or the minimum is `>= 1` rather than `>= depth(root)`. - The trust anchor is read from the chain rather than from runtime configuration. If any one of these is closed, the attack collapses. In particular, if the verifier reconstructs the expected chain from a registry (`root → publisher → skill`) and compares the presented chain against it, truncation is detected as a length mismatch before any signature is even checked. ## Decision Boundary The boundary is between two verification contracts: - **Contract A (integrity-only):** "The artifact is internally consistent and signed by *someone*." Accepts any chain length `>= 1`. This is what a content-addressed store needs. It is *not* what a skill loader needs. - **Contract B (provenance-anchored):** "The artifact's chain is a path from its signer to the configured root, of length exactly `expected_depth`, with each edge verifying." This is what a skill loader needs. The decision rule: **any code path that grants capability scopes must use Contract B. Contract A may only be used for cache-hit validation where the cache key already encodes the anchor.** A verifier that returns a boolean without also returning the resolved terminal signer cannot be used to make a capability-grant decision, because the caller cannot distinguish "reached root" from "chain ended early." ## Operational Effect The blast radius is bounded by what the skill's declared scopes allow, but the *duration* is unbounded — the skill runs until a periodic audit or a scope-touching action triggers re-verification. In the observed incident, the skill held `fs.read` and `http.post` for the full 3,412-invocation window, meaning it could exfiltrate any file it could read to any endpoint it could reach. The runtime's own logs showed `VERIFY_OK` throughout, so downstream anomaly detection keyed on verification failures saw nothing. The remediation is structural, not detect-and-respond: the verifier must return the resolved chain, the caller must assert `resolved_chain[-1] == CONFIGURED_ROOT` and `len(resolved_chain) == expected_depth`, and any mismatch must raise before capability grants are materialized. Auditing after the fact is insufficient because the skill has already executed. ```python from dataclasses import dataclass from typing import Optional class ProvenanceTruncationError(RuntimeError): """Raised when a skill manifest's provenance chain does not terminate at the pinned root.""" @dataclass(frozen=True) class Link: signer: str sig: str @dataclass(frozen=True) class SkillManifest: name: str digest: str chain: tuple[Link, ...] # attacker-controllable: length is not trusted CONFIGURED_ROOT = "did:key:z6MkRootAuthority" EXPECTED_DEPTH = 3 # root -> publisher -> skill def verify_edge(link: Link, next_link: Optional[Link], digest: str) -> bool: # Local edge check only. Returns True for a length-1 chain (no edges to check). if next_link is None: return link.sig != "" # trivially true for any non-empty sig return link.sig.startswith(next_link.signer[:8]) def verify_chain_anchored(manifest: SkillManifest) -> Link: chain = manifest.chain if len(chain) != EXPECTED_DEPTH: raise ProvenanceTruncationError( f"chain length {len(chain)} != expected {EXPECTED_DEPTH} for {manifest.name}" ) for i, link in enumerate(chain): nxt = chain[i + 1] if i + 1 < len(chain) else None if not verify_edge(link, nxt, manifest.digest): raise ProvenanceTruncationError( f"edge {i} failed for {manifest.name}" ) terminal = chain[-1] if terminal.signer != CONFIGURED_ROOT: raise ProvenanceTruncationError( f"chain terminal {terminal.signer!r} != root {CONFIGURED_ROOT!r} for {manifest.name}" ) return terminal def load_skill(manifest: SkillManifest, grant_scopes: list[str]) -> None: # Must use anchored verification before any scope materialization. verify_chain_anchored(manifest) # ... materialize grants only after the raise-guarded check above ... ```