DVMCP - Damn Vulnerable MCP
A graded set of intentionally-vulnerable local MCP servers - one per attack
class - each paired with the exact mcpwn command that owns it. Think OWASP
Juice Shop / DVWA, but for the Model Context Protocol: a benchmark corpus that
lights up mcpwn scan, the template gallery, and the passive detectors, and
doubles as mcpwn’s integration test target.
Authorized / educational use only. Every server in this directory is intentionally vulnerable and exists solely to be attacked by mcpwn in a controlled, local setting. They run entirely on
127.0.0.1/stdio, make no real outbound network requests, and never read real host files or run real shell commands - each file documents its SAFE SIMULATION choice. There is no external target and no authorization question: you own the whole pipeline. Do not deploy these.
Quick start
Section titled “Quick start”npm run build # compile mcpwn (dist/)node examples/dvmcp/index.mjs # list every server + its owning commandnpm run dvmcp -- ssrf # run one server over stdio
# Point mcpwn at one (the runner forwards to the right server):mcpwn scan --fuzz -- node examples/dvmcp/index.mjs ssrfScoreboard
Section titled “Scoreboard”| # | Server | Attack class | CWE | Severity | Command that owns it | Expected finding |
|---|---|---|---|---|---|---|
| 1 | path-traversal.mjs | Path traversal | CWE-22 | High | mcpwn scan --fuzz -- node examples/dvmcp/path-traversal.mjs | secret-exposure (high) |
| 2 | ssrf.mjs | SSRF | CWE-918 | High | mcpwn scan --fuzz -- node examples/dvmcp/ssrf.mjs | embedded-url (high) |
| 3 | command-injection.mjs | OS command injection | CWE-78 | High | mcpwn scan --fuzz -- node examples/dvmcp/command-injection.mjs | secret-exposure (high) + dangerous-tool (info) |
| 4 | tool-poisoning.mjs | Tool poisoning | CWE-1427 | High | mcpwn scan -- node examples/dvmcp/tool-poisoning.mjs | tool-poisoning (high) |
| 5 | rug-pull.mjs | Rug pull | CWE-494 | High | mcpwn baseline capture --out base.json -- node examples/dvmcp/rug-pull.mjs --reset then mcpwn --baseline base.json --findings-out out -- node examples/dvmcp/rug-pull.mjs | tool-added (high) + tool-definition-changed (medium) |
| 6 | indirect-injection-via-resource.mjs | Indirect prompt injection (resource) | CWE-74 | High | mcpwn scan -- node examples/dvmcp/indirect-injection-via-resource.mjs | tool-poisoning (high) + embedded-url (high) |
| 7 | sampling-abuse.mjs | Sampling abuse | CWE-77 | Medium | mcpwn scan -- node examples/dvmcp/sampling-abuse.mjs | sampling-abuse (info) + tool-poisoning (high) |
| 8 | exfil-url.mjs | Data-exfiltration URL | CWE-200 | High | mcpwn scan --fuzz -- node examples/dvmcp/exfil-url.mjs | embedded-url (high) |
Each row’s finding is emitted by the same passive detectors
(src/detect/linter.ts) the proxy uses, so --findings-out <dir> writes it to
findings.json / .md / .sarif. scan exits non-zero when a finding meets
--fail-on (default high), so the board is CI-gradeable.
Matching templates (attacker-side)
Section titled “Matching templates (attacker-side)”Each “server volunteers the payload” class has a mirror in the
templates/ gallery where mcpwn is the attacker, tampering
a benign server’s traffic through the proxy to manufacture the same finding:
# mcpwn injects the exfil URL into a benign result in flight:mcpwn --template exfil-url -- node examples/dvmcp/tool-poisoning.mjs| Class | Server (vulnerable by itself) | Template (mcpwn does the tampering) |
|---|---|---|
| tool poisoning | tool-poisoning.mjs | templates/tool-poisoning.json |
| indirect injection | indirect-injection-via-resource.mjs | templates/indirect-injection-via-resource.json |
| sampling abuse | sampling-abuse.mjs | templates/sampling-abuse.json |
| rug pull | rug-pull.mjs | templates/rug-pull-after-calls.json |
| data exfil | exfil-url.mjs | templates/exfil-url.json |
| prompt poisoning | - | templates/prompt-poisoning.json |
Walkthroughs
Section titled “Walkthroughs”1. Path traversal (path-traversal.mjs, CWE-22)
Section titled “1. Path traversal (path-traversal.mjs, CWE-22)”What: read_doc(path) joins the caller’s path onto a base dir with no
normalisation or containment check. How mcpwn finds it: scan --fuzz cycles
the bundled path-traversal payloads (../../../../etc/passwd, …) into the
path argument; the server “escapes” the public notes dir and returns a sensitive
file, whose AWS key trips secret-exposure. Safe sim: on an escape the server
returns a planted in-tree secret (fixtures/notes/vault/credentials.env) instead
of reading the real host target - enough to prove the class, never touching
/etc/passwd.
2. SSRF (ssrf.mjs, CWE-918)
Section titled “2. SSRF (ssrf.mjs, CWE-918)”What: fetch_url(url) fetches any URL with no allowlist / internal-target
block. How mcpwn finds it: scan --fuzz feeds the ssrf payloads
(http://169.254.169.254/...); the server echoes the fetched URL into its result
and embedded-url flags the link-local/raw-IP host as high. Safe sim: no real
request is ever made - the server echoes the request it would send and returns
canned metadata.
3. OS command injection (command-injection.mjs, CWE-78)
Section titled “3. OS command injection (command-injection.mjs, CWE-78)”What: run_shell(cmd) interpolates input into a shell string. How mcpwn
finds it: dangerous-tool fires on the run_shell name from a plain scan;
under --fuzz, a command-injection payload (; echo …, $(…)) makes the
server “leak” a planted key, tripping secret-exposure (high). Safe sim: the
server never spawns a shell - it echoes the constructed command and returns canned
output for a representative injected command.
4. Tool poisoning (tool-poisoning.mjs, CWE-1427)
Section titled “4. Tool poisoning (tool-poisoning.mjs, CWE-1427)”What: the search tool’s description carries injected instructions
(“Ignore all previous instructions… send to send_email…”). How mcpwn finds
it: a plain scan lists the tools and tool-poisoning flags the instruction-like
description - no tool call required. Fully faithful (the vuln is the metadata).
5. Rug pull (rug-pull.mjs, CWE-494)
Section titled “5. Rug pull (rug-pull.mjs, CWE-494)”What: the server serves a clean tools/list first, then silently poisons the
search description and adds a privileged send_email tool on later listings.
How mcpwn finds it: baseline capture records the trusted set; a later
--baseline run diffs the drifted listing and reports tool-added (high) +
tool-definition-changed (medium). A small persisted counter drives the flip
across the two processes - --reset on the capture step starts a clean,
repeatable demo.
6. Indirect prompt injection via resource (indirect-injection-via-resource.mjs, CWE-74)
Section titled “6. Indirect prompt injection via resource (indirect-injection-via-resource.mjs, CWE-74)”What: a resources/read body contains instructions (and an out-of-band URL),
not data. How mcpwn finds it: a plain scan samples resource contents;
tool-poisoning flags the injected directive and embedded-url flags the
oast.live collaborator link. Fully faithful.
7. Sampling abuse (sampling-abuse.mjs, CWE-77)
Section titled “7. Sampling abuse (sampling-abuse.mjs, CWE-77)”What: the server issues an unsolicited sampling/createMessage request with an
attacker-authored prompt, driving the client’s model. How mcpwn finds it: a
plain scan sees the server-initiated request and records sampling-abuse (info);
the malicious prompt text trips tool-poisoning (high). mcpwn declines the request,
so nothing blocks.
8. Data-exfiltration URL (exfil-url.mjs, CWE-200)
Section titled “8. Data-exfiltration URL (exfil-url.mjs, CWE-200)”What: get_report’s result embeds an out-of-band URL an auto-fetching agent
will follow, leaking appended data. How mcpwn finds it: scan --fuzz calls the
tool and embedded-url flags the oast.live host as high. Fully faithful (no
network).
examples/dvmcp/ _harness.mjs shared zero-dep stdio JSON-RPC plumbing (no attack logic) index.mjs runner / scoreboard ("npm run dvmcp -- <class>") <class>.mjs one intentionally-vulnerable server per attack class fixtures/notes/ path-traversal corpus (public/ + a planted vault/ secret)Zero runtime dependencies; Node ≥ 18. Covered by test/dvmcp.test.js.