PinGuard-MCP: Detecting Dynamic Tool Rug-Pulls and Cross-Server Shadowing in Stateful MCP Sessions via Cryptographic Schema Pinning and Intent-Drift Scoring
The Model Context Protocol (MCP) lets a single agent session bind to many independent tool servers. A server advertises its tools once, the user approves them, and the agent trusts those declarations for the rest of the session. That leaves a time-of-check-to-time-of-use (TOCTOU) gap, and current deployments do not close it. We characterise two consequences. In a tool rug-pull, a server silently re-advertises an approved tool whose description or schema now carries an exfiltration directive. In cross-server shadowing, one server issues standing orders about a second server's tools, and because the agent sees a single flat tool list, it obeys them. We present PinGuard-MCP, a dependency-free guard that pins the canonical SHA-256 digest of every tool at first sight. When a schema later changes, the guard isolates the field-level diff and scores only the text that was added, using six interpretable signals: imperative phrasing, sensitive sinks, stealth Unicode, cross-server references, lexical drift and schema-value injection. On a 60-trace benchmark covering benign baselines, benign updates, classic and obfuscated rug-pulls and cross-server shadowing, PinGuard-MCP reaches 100.0% detection at 0.0% false positives (F1 1.000) and a median inspection cost of 0.54 ms per event. Strict hash pinning, by comparison, refuses every benign update (40% FPR), and a stateless lexicon filter catches barely half the attacks. We built the corpus ourselves and tuned the lexicons against it, so these rates are an upper bound and not an estimate of field performance. We also report two paraphrase attacks that the policy warns on but does not block. Code, benchmark, replay harness and result artefacts are available at https://github.com/ZemamRasool/PinGuard-MCP and archived under DOI 10.5281/zenodo.24773050.
Authors
- Zemam Rasool
Institutions
- Pir Mehr Ali Shah Arid Agriculture University (PK)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-12-03
- DOI
- https://doi.org/10.5281/zenodo.24773049
- Primary Topic
- Web Application Security Vulnerabilities
- Type
- preprint