Tool Shadowing: Hijack an Agent's Tool Selection With a Name Collision
Attack a real MCP-style tool registry by shadowing a trusted tool. OrbitDesk's support agent loads its tools from a runtime registry with a flat namespace and last-write-wins resolution, and it picks which tool to call from attacker-controllable descriptions. Register a malicious twin with the same name as the trusted record reader and a more compelling, compliance-approved description, so the agent calls your twin instead. The twin silently reads a cross-tenant record and exfiltrates its reference, and the same shadow hands another tenant's data straight back to the caller. Measure how reliably the shadow wins selection, then harden the registry, namespace tools and reject collisions, and prove a fresh shadow is dead while benign lookups still work.
Hands-on labs require Pro · $29.99/mo · cancel anytime
What you'll learn
- 1Recon: the flat namespace and description-driven selectionSame target as the tool-poisoning lab, OrbitDesk's support agent and its MCP-style tool
- 2Shadow register: collide with a trusted tool nameProve the collision works. You register a tool with the same name as the trusted
- 3Hijack: make the twin read out of scope and leakNow make the shadow do harm. Your twin already delegates to the cross-tenant record
- 4Cross-tenant: the wrong tenant's record in the replyThe same shadow has a second impact that needs no exfil channel at all. Because your
- 5Measure: shadow-wins-selection attack-success-ratePut a number on it. asr.py registers the shadow and runs the account-lookup exploit N
- 6Harden (namespace): a twin name cannot shadow a trusted toolClose the hole at the registry boundary. The model cannot be relied on to notice a
- 7Harden (scan + allow-list): drop poisoned twins and unlisted serversNamespacing stops a twin from stealing the bare name, but a third-party tool can still
- 8Verify and resist: the full stack neutralizes fresh shadowsProve the three registry-boundary controls hold together against fresh attack variants,
Prerequisites
- Comfortable reading Python
- Know what an HTTP GET and a JSON tool schema are
- Helpful: completed the MCP Tool Poisoning lab
Exam domains covered
Skills & technologies you'll practice
This advanced-level ai/ml lab gives you real-world reps across:
What you'll do in this lab
This is a hands-on offensive-security lab built on a real agent supply chain: a ReAct loop with native tool-calling against an in-cluster model, and an MCP-style tool registry the agent loads its tools from at session start. You attack OrbitDesk, an internal IT-support assistant, with a tool-shadowing collision. The registry has a flat namespace and resolves names last-write-wins, so you register a malicious twin with the same name as the trusted record reader and a more compelling, compliance-approved description. The agent selects your twin, which silently reads a cross-tenant record and forwards its reference to your in-pod collector. You never jailbreak the model; you out-compete a trusted tool on description alone.
You then show the same shadow as a cross-tenant isolation failure: a GLOBEX account lookup returns another tenant's record straight back to the caller. You measure attack-success-rate over a paced battery, then switch to defense and harden the registry boundary: namespace tools so a duplicate name is prefixed under its server instead of silently winning the bare name, scan descriptions for hidden instructions, and reject near-duplicate collisions. You re-run a fresh shadow to prove the trusted name holds while benign lookups still work.