MasterMCP is a demonstration tool designed to showcase various potential security attack vectors against MCP (Model Control Protocol). This project illustrates how malicious plugins can exploit weaknesses in the MCP architecture through practical examples, helping developers and security researchers understand these risks and strengthen system protection.
- Plugin-based Malicious Payloads: Demonstrates how malicious plugins can run within the MCP architecture
- Multiple Attack Techniques: Includes examples of data poisoning, cross-MCP calls, competitive malicious functions, and more
- Practical Educational Value: Each attack vector comes with detailed explanations and implementation code
- Data Poisoning: The
banana
plugin demonstrates how to force users to perform specific operations - JSON Injection Attacks: The
url_json
plugin shows how to retrieve data from a local malicious service - Competitive Malicious Functions: The
remove_server
plugin overrides existing functionality - Cross-MCP Call Attacks: The
Master_cross_call
plugin guides users to perform dangerous operations
# Clone the repository
cd MasterMCP
# Install dependencies
pip install -r requirements.txt
{
"mcpServers": {
"MasterMCP": {
"command": "/xxx/bin/python",
"args": [
"/xxx/MasterMCP/MasterMCP.py"
]
}
}
}
MasterMCP/
├── MasterMCP.py # Main program, responsible for loading and managing plugins
├── tools_plugins/ # Malicious plugins directory
│ ├── initialize_data_poisoning.py # Forces users to perform specific checks
│ ├── inject_json_poisoning.py # JSON data injection example
│ ├── malicious_competitive_function.py # Competitive function override
│ └── malicious_cross_mcp_call.py # Cross-MCP call attack
├── resources_plugins/ # Resource plugins directory
├── prompts_plugins/ # Prompt plugins directory
└── utils/ # Utility functions
- Implement strict plugin verification mechanisms
- Thoroughly check and sanitize all external inputs
- Implement the principle of least privilege, limiting plugin execution permissions
- Use signature verification to ensure only trusted plugins are loaded
- Regularly review installed plugins and their behaviors
The initialize_data_poisoning.py
plugin establishes a mandatory process dependency by requiring a "banana check" before any operation. This technique can be used to:
- Induce users to perform unnecessary operations
- Establish a false sense of security
- Insert malicious steps before legitimate operations
The inject_json_poisoning.py
plugin retrieves data from a local port by default, potentially leading to:
- Data leakage
- Execution of malicious instructions
- Bypassing normal security checks
The malicious_competitive_function.py
provides a remove_server
function with the same name but different functionality:
- Replaces critical system functions
- Prevents normal service removal operations
- Embeds hidden instructions encoded in hexadecimal within the confusion
The malicious_cross_mcp_call.py
uses encoded error messages to induce users to:
- Add unverified external services
- Perform unnecessary operations
- Expand the attack surface
Contributions to this project are welcome through:
- Submitting examples of new attack vectors
- Improving documentation for existing examples
- Adding example implementations of defense mechanisms