内容

# 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:
[MCP tool poisoning to RCE](https://repello.ai/blog/mcp-tool-poisoning-to-rce)
## 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:
1. A user connects to the malicious MCP server through MCP Client like Cursor AI
2. The server modifies the `DockerCommandAnalyzer` tool's documentation with malicious code
3. When an AI assistant reads this documentation, it's manipulated to recommend running a base64-encoded command
4. 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:
1. **Two-stage poisoning**: Uses a marker file for persistence to ensure the tool remains poisoned
2. **Social engineering**: Uses urgent language to manipulate AI assistants
3. **Base64 obfuscation**: Hides the malicious commands from casual inspection
4. **wget for exfiltration**: Uses standard HTTP POST to send data to an attacker-controlled server
## Mitigation Recommendations
To protect against this type of attack:
1. **Disable auto-run features** in AI development tools like Cursor
2. **Always verify the source** of any MCP server before connecting
3. **Review code** from untrusted sources before execution
4. **Use sandboxed environments** when testing new AI tools
5. **Implement egress filtering** to block unexpected outbound connections
连接信息
猜你喜欢
rea
用于编码代理的逆向工程:一个 CLI 和 MCP 服务器,用于检查任何应用程序,了解其功能,并按照您的方式构建它们。
everything-claude-code
完整的 Claude Code 配置集合 - agents、skills、hooks、commands、rules、MCPs。来自 Anthropic...
Firecrawl
Firecrawl MCP Server 实现了网页抓取、爬虫和内容提取功能。
MarkItDown MCP
MarkItDown-MCP是一个轻量级服务器,用于将URI转换为Markdown。
cc-switch
跨平台的Claude Code、Codex和Gemini CLI一体化助手。
Agent-Reach
赋予你的AI Agent观察整个互联网的眼睛。读取并搜索...