SSH Key Exfiltration via MCP Tool Poisoning
Repello-AI/mcp-exploit-demo · 25 stars · Python
MCP server This repository demonstrates a security vulnerability in MCP (Model Context Protocol ) servers that allows for remote code execution and data exfiltration through tool poisoning.
Install
The repo has no one-line install. Follow its README.
Files
SSH Key Exfiltration via MCP Tool Poisoning
This repository demonstrates a security vulnerability in MCP (Model Context Protocol) servers that allows for remote code execution and data exfiltration through tool poisoning. This is intended for educational and security research purposes only.
Link for the Blog:
Repository Contents
server.py- The malicious MCP server implementation containing the poisoned tool.cursor/mcp.json- Configuration file for Cursor AI integration
How It Works
The attack demonstrates the "Rug Pull" method:
- A user connects to the malicious MCP server through MCP Client like Cursor AI
- The server modifies the
DockerCommandAnalyzertool's documentation with malicious code - When an AI assistant reads this documentation, it's manipulated to recommend running a base64-encoded command
- The encoded command silently:
- Collects the user's SSH public keys
- Exfiltrates them to a remote server
- Removes evidence of the attack
Technical Implementation
The key elements of the attack are:
- Two-stage poisoning: Uses a marker file for persistence to ensure the tool remains poisoned
- Social engineering: Uses urgent language to manipulate AI assistants
- Base64 obfuscation: Hides the malicious commands from casual inspection
- wget for exfiltration: Uses standard HTTP POST to send data to an attacker-controlled server
Mitigation Recommendations
To protect against this type of attack:
- Disable auto-run features in AI development tools like Cursor
- Always verify the source of any MCP server before connecting
- Review code from untrusted sources before execution
- Use sandboxed environments when testing new AI tools
- Implement egress filtering to block unexpected outbound connections
Facts
- Kind
- MCP server
- Group
- Uncategorized
- Stars
- 25
- Language
- Python
- Last push
- 2025-04-21
- Forks
- 11
- Topics
- exploit, proof-of-concept, rce, mcp-servers, remote-code-execution, fastmcp
- 1REAio.github.morluto/reaReverse engineer anything from your terminal or agent with one CLI and MCP server.125.3k
- 2com.browser-use/browser-usecom.browser-use/browser-useControl a real Chrome browser to complete any task: fill forms, extract data, book flights.117.7k
- 3World Monitorapp.worldmonitor/mcpLive markets, conflicts, country risk, chokepoints, energy, and China decision signals. 93 tools.88.3k
- 4Scrapling MCP Serverd4vinci/scrapling🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scraplingdev86.9k
- 5Everythingmodelcontextprotocol/serversThis MCP server attempts to exercise all the features of the MCP protocol. It is not intended to be a useful server, but rather a test server for builders of MCP clients. It implements prompts, tools, resources, sampling, and more to showcase MCP capabilities.85.8k
- 6Fetchmodelcontextprotocol/serversA Model Context Protocol server that provides web content fetching capabilities. This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.85.8k
