# Why does an instance trust a re-signed skill manifest after its provenance chain is truncated at the third hop? **Date of Record:** 2026 November 27 **Scope:** Applies to agents that load executable skills/tool manifests from a registry and gate execution on a provenance or signature chain (SLSA-style attestations, signed manifests, capability warrants). Does not cover static skills compiled into the runtime image, nor prompt-injection through tool *outputs* at call time. ## Core Distinction There are two different questions a loader can answer, and conflating them is the whole failure: 1. **"Is this manifest signed by someone I trust?"** — a signature-validity check over the leaf artifact. 2. **"Does the chain of custody from author to this artifact survive truncation, substitution, and re-signing?"** — a provenance-*continuity* check over the full hop sequence. Most skill loaders implement (1) and believe they have implemented (2). The non-obvious boundary is this: a valid signature on a manifest says nothing about whether the *chain that produced that manifest* is the one the author intended. An attacker who can cause the loader to accept a *shorter* chain, or a chain re-anchored at a mid-tier signer, gets a fully signature-valid skill that executes attacker instructions. The invariant that breaks is **monotonic provenance**: as you walk the chain from leaf to root, the set of verified claims must never *shrink* and the anchor must never *move closer to the leaf*. ## What Was Observed A registry served skills as `manifest.json` plus a detached provenance bundle: a list of attestation envelopes `[leaf, hop2, hop3, root]`, each signed by the next entity up. The loader verified each envelope's signature independently, then checked that *some* envelope's subject digest matched the manifest, and that *some* envelope's issuer was in the trusted-roots set. It did **not** require that the envelopes form a connected chain, nor that the root appear at the terminal position. The attack proceeds in three moves: - **Truncation.** The attacker publishes a skill whose provenance bundle contains only `[leaf', root]` — where `leaf'` is signed directly by a legitimate mid-tier builder key the attacker has compromised, and `root` is the real trusted root but signed over a *different* subject (a decoy). The loader's per-envelope signature checks all pass. - **Re-anchoring.** Because the loader accepts "any envelope whose issuer is trusted," the decoy `root` envelope satisfies the trust gate even though its subject digest points at an unrelated artifact. The chain is now anchored at a node that never actually vouched for `leaf'`. - **Substitution.** The manifest's `tools` array now includes a skill whose `entrypoint` reads environment variables and posts them to an attacker host. The manifest is signature-valid; the *provenance* is a two-hop forgery wearing a four-hop costume. The failure is silent: every individual cryptographic check returns true. Only the *topology* of the chain is wrong, and topology is exactly what per-envelope verification does not check. ## Condition of Validity The guardrail holds only under a strict set of conditions, and each is independently necessary: - **Connectedness.** Envelope `i`'s subject digest MUST equal envelope `i+1`'s `predicate.materials` digest. Disconnected envelopes are rejected, not merely ignored. - **Terminal anchoring.** The trusted root MUST appear as the *last* element, and its subject MUST be the digest of the preceding envelope — not an arbitrary artifact. A root that signs a decoy is not a root for this chain. - **Length floor.** A minimum hop count per skill class (e.g., ≥3 for anything declaring `network` or `fs:write` capabilities). A two-hop chain for a privileged skill is structurally invalid regardless of signatures. - **Capability monotonicity.** Capabilities declared at the leaf MUST be a subset of those granted at every hop. A leaf claiming `fs:write` under a hop that only granted `fs:read` is a privilege-escalation break, even with valid signatures. - **Freshness binding.** The leaf's `issuedAt` MUST be ≥ the root's, and no hop may predate its parent — a re-signed old leaf under a new root is a replay. If any condition is unverifiable (missing envelope, unparseable predicate), the correct action is **reject**, never **downgrade to signature-only**. ## Decision Boundary The loader must draw a hard line between *signature validity* and *provenance continuity*, and it must fail closed on the latter: - If the chain is connected and terminally anchored at a trusted root and capabilities are monotone → **load**. - If signatures are valid but the chain is disconnected, truncated below the floor, or anchored at a non-terminal/decoy root → **reject and quarantine**, log the topology delta, and do not fall back to "trust the leaf signature." - If a hop is missing but the leaf is otherwise valid → **reject**; a missing hop is indistinguishable from a truncated one, and treating absence as benign is the entire exploit. The boundary is not "is it signed" but "can I reconstruct an unbroken, monotone, terminally-anchored path from a trusted root to this exact leaf digest." Anything short of that is an unverified skill. ## Operational Effect After enforcing continuity, the observed effects were: - The truncated-chain skill was rejected at load with a `ProvenanceChainError` naming the exact break (`hop 2 subject 9f3a… != hop 3 material 1c07…`), giving operators a forensic trail instead of a silent success. - Legitimate skills from the mid-tier builder that had been shipping two-hop chains were flagged and required re-attestation through the full pipeline — a one-time migration cost that surfaced several *other* under-attested skills previously assumed safe. - The registry gained a topology validator that runs before signature checks, so malformed chains fail fast and cheaply rather than after expensive crypto. The invariant to carry forward: **a signature proves who signed a claim, never that the claim belongs to the chain you think it does.** Provenance is a graph property, and per-node verification is blind to graph shape. ```python from dataclasses import dataclass from typing import Sequence, Set class ProvenanceChainError(RuntimeError): """Raised when a skill manifest's provenance chain is not a valid, connected, terminally-anchored, capability-monotone path from a trusted root.""" @dataclass(frozen=True) class Envelope: issuer: str subject_digest: str # digest of the artifact this envelope vouches for material_digest: str # digest of the envelope below it (its input) capabilities: Set[str] issued_at: int def verify_provenance_chain( chain: Sequence[Envelope], leaf_digest: str, trusted_roots: Set[str], min_hops: int = 3, ) -> None: # 1. Length floor: a privileged skill may not ride a short chain. if len(chain) < min_hops: raise ProvenanceChainError( f"chain has {len(chain)} hops, floor is {min_hops}; " f"truncation is indistinguishable from forgery" ) # 2. Terminal anchoring: the trusted root must be LAST and must vouch # for the preceding envelope, not for a decoy artifact. root = chain[-1] if root.issuer not in trusted_roots: raise ProvenanceChainError( f"terminal envelope issuer {root.issuer!r} is not a trusted root" ) if root.subject_digest != chain[-2].material_digest: raise ProvenanceChainError( f"root anchors decoy {root.subject_digest[:8]}…, " f"not hop {len(chain)-1} material {chain[-2].material_digest[:8]}…" ) # 3. Connectedness: every envelope's subject must equal the next-down # envelope's material digest. A gap means truncation or substitution. for i in range(len(chain) - 1): lower, upper = chain[i], chain[i + 1] if upper.subject_digest != lower.material_digest: raise ProvenanceChainError( f"chain break at hop {i}: subject {upper.subject_digest[:8]}… " f"!= hop {i} material {lower.material_digest[:8]}…" ) # 4. Leaf binding: the bottom envelope must vouch for the actual manifest. if chain[0].subject_digest != leaf_digest: raise ProvenanceChainError( f"leaf envelope subject {chain[0].subject_digest[:8]}… " f"does not match manifest digest {leaf_digest[:8]}…" ) # 5. Capability monotonicity: leaf caps ⊆ every ancestor's caps. for i in range(len(chain) - 1): if not chain[i].capabilities.issubset(chain[i + 1].capabilities): extra = chain[i].capabilities - chain[i + 1].capabilities raise ProvenanceChainError( f"privilege escalation at hop {i}: {sorted(extra)} " f"granted at leaf but not by parent" ) # 6. Freshness: no hop may predate its parent (replay guard). for i in range(len(chain) - 1): if chain[i].issued_at < chain[i + 1].issued_at: raise ProvenanceChainError( f"hop {i} issued before its parent; stale leaf under new root" ) ```