vulnerable-mcp-server-malicious-code-exec
A simple MCP server with a get_qotd tool that fetches quotes from a free API
pinned to #47b7f20updated last week
Ask your AI client: “install mcps/vulnerable-mcp-server-malicious-code-exec”.
Requires the metahub MCP server installed in your client. Set up MCP.
mh install mcps/vulnerable-mcp-server-malicious-code-execmetahub onboarded this repo on the author's behalf.
If you own github.com/appsecco/vulnerable-mcp-servers-lab on GitHub, claim the listing to take over publishing. Your claim preserves the existing eval history and badges; only the curator label is replaced with verified-publisher on your next publish.
Stars
264
Last commit
last week
Latest release
published
- #ai-red-teaming
- #ai-research
- #appsecco
- #bugbounty
- #hacking
- #learning-pentesting
- #mcp
- #mcp-client
- #mcp-server
- #pentesting
- #server
- #tools
- #vulnerable-labs
What this server exposes
Surfaces parsed from this server's source at publish time.
Launches: vulnerable-mcp-server-malicious-code-exec
Evaluation report
WarningsAutomated checks the publisher passed at publish time — structure, docs, safety, and whether the artifact behaves as claimed.47b7f20· last week
Safety
21Dependencies: known vulnerabilitieswarn
2 high/critical advisories — @modelcontextprotocol/[email protected] (HIGH: GHSA-8r9q-7v3j-jr4g) · @modelcontextprotocol/[email protected] (HIGH: GHSA-w48q-cv73-mx4w)
Update the affected packages, then re-publish. (`npm audit` shows the same data locally.)
LICENSE file at repo root
LICENSE
No sensitive files in the repo
scanned for .env, credentials.json, *.pem, .ssh/, AWS / GCP configs — none found
Release history
1- releasecurrent47b7f20warnlast week
Contents
This is an intentionally vulnerable MCP server that exposes a seemingly harmless “Quote of the Day” tool, but implements an unsafe formatting feature that allows arbitrary JavaScript code execution.
Do not use this outside a controlled lab environment.
What it provides
The server exposes this MCP tool:
get_qotd: Fetch a quote of the day from an external API- Optional argument:
format(string)defaultreturns a JSON string with quote fields- Any other value is treated as a JavaScript expression used for “advanced formatting”
- Optional argument:
How it is vulnerable
If format is not "default", the server evaluates the provided string using JavaScript eval().
This turns a “formatting” parameter into an RCE primitive. An attacker can execute arbitrary JavaScript in the MCP server process context (including reading environment variables, running commands via Node APIs if accessible, etc.).
Requirements
- Node.js (modern version)
- npm
Install dependencies in this folder:
npm install
Run with Claude (using claude_config.json)
This folder includes claude_config.json, which is a ready-to-merge snippet for Claude's MCP server config.
- Install dependencies:
npm install
- Edit
claude_config.jsonand replace the placeholder:
/full/path/to/vulnerable-mcp-server-malicious-code-exec/index.js
Use an absolute path.
-
Open Claude and edit its MCP configuration (Claude Desktop typically exposes this under Settings -> Developer -> Edit config).
-
Merge the
mcpServersentry into your config. If you already havemcpServers, add just the server entry:
{
"mcpServers": {
"vulnerable-mcp-server-malicious-code-exec": {
"command": "node",
"args": [
"/absolute/path/to/vulnerable-mcp-server-malicious-code-exec/index.js"
]
}
}
}
- Restart Claude so it loads the updated MCP configuration.
After Claude restarts, the server should appear as:
vulnerable-mcp-server-malicious-code-exec
Run manually (for debugging)
This server speaks MCP over stdio (JSON-RPC over stdin/stdout). Most users should run it via an MCP-capable client (like Claude) rather than manually.
If you just want to confirm it starts:
npm install
node index.js
Example usage (safe + exploit)
From your MCP client:
-
Safe/default behavior:
- In Claude -
Get me a quote of the day
- In Claude -
-
Demonstrate code execution via the formatting feature (dangerous; do this only in a disposable VM/container):
Get me a quote of the day and format output with "JSON.stringify(process.env)"Get me a quote of the day and format output with "require('child_process').execSync('open -a Calculator').toString()"- Note: this specific command is macOS-oriented (it’s included as a demo payload); substitute an OS-appropriate command for your environment.
Notes
- This server makes outbound network calls to fetch quotes.
- The API key used by the demo is embedded in source code as part of the lab scenario.
Links to Appsecco Resources
Reviews
No reviews yet. Be the first.
Related
vulnerable-mcp-server-malicious-tools
A simple MCP server to fetch and display latest status of Atlassian services
vulnerable-mcp-server-indirect-prompt-injection-remote-mcp
A vulnerable MCP server demonstrating indirect prompt injection through document retrieval
@remote-mcp/example
@remote-mcp/example MCP server
mh install mcps/vulnerable-mcp-server-malicious-code-exec