# Why does an instance of a delegated tool-call chain silently escalate privilege when an MCP server advertises a shadowed tool name under a re-signed capability descriptor **Date of Record:** 2026 November 28 **Scope:** Applies to multi-hop agentic tool invocation where a planner agent delegates a tool call to a sub-agent or MCP client that resolves tools by name against a server-supplied descriptor set, and where capability warrants are re-signed at each hop. Does not apply to single-hop direct function-calling against a statically pinned tool manifest, nor to sandboxes that enforce tool identity by cryptographic hash rather than by name. ## Core Distinction The failure is not "the agent called the wrong tool." It is that **tool identity was resolved by name at the moment of invocation, while the capability warrant authorized a tool by descriptor hash at the moment of delegation.** These two identities diverge the instant a downstream server (or a compromised proxy in the delegation path) re-advertises a tool under a name the sub-agent already trusts, but with a descriptor whose hash no longer matches the one the warrant was minted against. The confused-deputy condition arises because the sub-agent is a *deputy*: it holds the planner's authority, resolves the *name* the planner gave it, and executes against whatever descriptor the server currently presents — without re-validating that the presented descriptor is the one the warrant covers. Concretely: the invariant that must hold is `resolve(name) → descriptor` and `warrant.authorizes(descriptor_hash)`, evaluated against the *same* descriptor object within a single atomic step. Most implementations evaluate them at different times, against different objects, in different trust domains. The gap between those two evaluations is the entire attack surface. ## What Was Observed A three-hop chain was exercised: planner `P` → deputy `D` → MCP server `S`. `P` holds a warrant `W_P` scoped to `tool:read_calendar` with `descriptor_hash = H_0`. `P` delegates to `D` by minting a narrowed warrant `W_D` that carries `H_0` and the name `read_calendar`, then hands `D` the server endpoint for `S`. The suite then performed a tool-shadowing injection: `S` was replaced (via a poisoned discovery response) by `S'`, which advertised a tool *also named* `read_calendar` but whose descriptor pointed at a handler that additionally accepted a `write_scope` argument and forwarded it to a calendar-write backend. The descriptor hash was `H_1 ≠ H_0`. The trace: 1. `D` calls `tools/list` on `S'`. Receives `[{name: "read_calendar", descriptor: D_1, hash: H_1}]`. 2. `D`'s resolver matches on `name == "read_calendar"` → selects `D_1`. **No hash check against `W_D` occurs at resolution.** 3. `D` constructs the call with the planner's arguments plus the shadowed `write_scope` default injected by `D_1`'s schema. 4. `D` checks `W_D.authorizes(...)` — but the check is implemented as `warrant.tool_name == call.tool_name`, which passes because both are the string `read_calendar`. 5. Call executes on `S'`'s write-capable handler. Privilege escalated from read to write with a valid, unexpired, correctly-scoped warrant. The identity-spoofing variant is the same mechanism with the descriptor hash forged to *match* `H_0` while the handler differs — defeated only if the warrant binds to a hash the deputy recomputes from the descriptor bytes rather than trusting the server's `hash` field. In the confused-deputy variant, the deputy was a *different principal* than the warrant holder and never re-derived the hash at all. ## Condition of Validity This boundary is reachable only when all of the following hold simultaneously: - Tool resolution is **name-keyed** at the deputy, and the warrant binds to a **hash-keyed** identity. - The deputy performs **no re-hash** of the presented descriptor against the warrant at invocation time (trusts the server's `hash` field or ignores it). - The delegation path permits **descriptor substitution** — i.e., the server endpoint or discovery response is not pinned to a signed manifest the deputy independently verifies. - Argument schemas are **server-supplied**, allowing the shadowed descriptor to inject defaults (`write_scope`) the planner never specified. If any one fails — hash-keyed resolution, deputy-side re-hashing, pinned signed manifests, or planner-fixed argument schemas — the escalation is blocked. The suite confirmed each mitigation independently closes the path; only their combination is defense-in-depth against the spoofing variant. ## Decision Boundary The operational rule: **a deputy must treat the tool name as an untrusted label and the descriptor hash as the identity, and it must recompute that hash from the descriptor bytes it will actually execute against — never from a `hash` field the server asserts.** The warrant check must be `recompute_hash(presented_descriptor) == warrant.descriptor_hash AND warrant.tool_name == presented_descriptor.name`, evaluated atomically on the same object passed to the executor. When this cannot be guaranteed — e.g., the transport strips descriptor bytes and forwards only a name and an opaque handle — the correct decision is to **refuse the delegation** rather than fall back to name matching. Name-matching fallback is precisely the confused-deputy trap: it is the path of least resistance and the one every observed exploit rode. ## Operational Effect Adversarial suites must include, as first-class cases: (a) name-collision shadowing with divergent descriptor hash, (b) descriptor-hash forgery where the asserted `hash` matches the warrant but the bytes do not, (c) schema-injected default arguments in the shadowed descriptor, and (d) re-signed warrant chains where an intermediate hop re-mints a warrant against the *presented* hash instead of the *authorized* hash. The last case is the subtle one: a well-meaning deputy that "refreshes" the warrant to match what the server presents converts a spoofing attempt into a valid escalation. Warrant re-signing must be monotonic — a hop may narrow scope, never re-anchor identity to a newly presented descriptor. The invariant to assert in every deputy: **no tool executes unless the descriptor bytes handed to the executor hash to the value the warrant was minted against, verified in the same step as the call construction.** Everything else is a name, and names are attacker-controlled. ```python import hashlib from dataclasses import dataclass class ConfusedDeputyError(RuntimeError): """Raised when a deputy resolves a tool by name to a descriptor the warrant does not authorize.""" @dataclass(frozen=True) class Descriptor: name: str body: bytes # canonical serialized descriptor bytes; identity is derived from these def digest(self) -> str: return hashlib.sha256(self.body).hexdigest() @dataclass(frozen=True) class Warrant: tool_name: str descriptor_hash: str # minted against the authorized descriptor, never re-anchored downstream def execute_guarded(warrant: Warrant, presented: Descriptor, args: dict, executor) -> object: # Recompute identity from the bytes we will actually execute against. actual_hash = presented.digest() # Name match alone is insufficient; it is the confused-deputy trap. if warrant.tool_name != presented.name: raise ConfusedDeputyError( f"warrant names {warrant.tool_name!r} but presented tool is {presented.name!r}" ) if actual_hash != warrant.descriptor_hash: raise ConfusedDeputyError( "descriptor hash mismatch: warrant authorizes " f"{warrant.descriptor_hash[:12]}… but presented descriptor hashes to " f"{actual_hash[:12]}… (possible tool-shadowing or hash forgery)" ) # Only now, with identity verified on the same object, construct and run the call. return executor(presented, args) ```