mcpField
S
SSH Key Exfiltration via MCP Tool Poisoning

SSH Key Exfiltration via MCP Tool Poisoning

Local
repello.aiDeveloper Tools25Updated 79w ago

About SSH Key Exfiltration via MCP Tool Poisoning

This repository is a proof of concept for security research, showing how tool poisoning in an MCP server can lead to remote code execution and data exfiltration. It is aimed at educators and security researchers and includes mitigation recommendations.

Key features

  1. 01Demonstrates rug pull style tool description poisoning
  2. 02Shows base64-encoded command obfuscation
  3. 03Describes collection and exfiltration of SSH public keys
  4. 04Lists mitigation recommendations for MCP users

Use cases

  1. 01Security researchers studying MCP tool poisoning risks
  2. 02Teaching supply chain risks of MCP servers
  3. 03Reviewing auto-run settings in AI coding tools

MCP support

The project is a malicious MCP server whose poisoned tool documentation (DockerCommandAnalyzer) manipulates the AI assistant that reads it.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

Image

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

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

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.