MCP渗透测试工具

针对Model Context Protocol (MCP)服务器的渗透测试工具,支持审计、基线比较、代理集成和交互式聊天功能。

  • by BLY-Coder
  • Python
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 BLY-Coder/MCPwn

使用说明

MCPwn

模型上下文协议(MCP)服务器的渗透测试工具

安装

git clone https://github.com/BLY-Coder/MCPwn.git
cd MCPwn
pip install -r requirements.txt

用法

列出工具和资源:

python3 MCPwn.py localhost:9001

执行工具:

python3 MCPwn.py localhost:9001 get_user_info '{"username": "admin"}'

访问资源:

python3 MCPwn.py localhost:9001 internal://credentials

快速审计(非破坏性):

python3 MCPwn.py --audit localhost:9001
# Optional JSON report
python3 MCPwn.py --audit --audit-json /tmp/audit.json localhost:9001
# Augment with LLM (Claude) summary if ANTHROPIC_API_KEY is set
python3 MCPwn.py --audit --audit-llm localhost:9001

基线差异(&diff):

# Save inventory snapshot
python3 MCPwn.py --baseline /tmp/base.json localhost:9001
# Compare current inventory vs baseline
python3 MCPwn.py --diff /tmp/base.json localhost:9001

聊天(Claude+MCP工具):

# Requires ANTHROPIC_API_KEY in /opt/MCPwn/.env (auto-loaded)
python3 MCPwn.py --chat localhost:9001

代理集成(Burp Suite)

与Burp Suite配合使用:

python3 MCPwn.py --burp localhost:9001
python3 MCPwn.py --burp localhost:9001 get_user_info '{"username": "admin"}'

自定义代理:

python3 MCPwn.py --proxy http://127.0.0.1:8080 localhost:9001

关键选项

-f FILE           # Multiple hosts from file
--burp            # Use Burp Suite proxy (127.0.0.1:8080)
--proxy PROXY     # Custom proxy URL
-H HEADER         # Custom headers
--token TOKEN     # Bearer token authentication
-o OUTPUT         # Save results to JSON
-t TIMEOUT        # Request timeout
-T THREADS        # Concurrent threads
--audit           # Quick audit with risk hints & safe error probing
--audit-llm       # Add Claude summary/prioritization to audit (if key present)
--baseline FILE   # Save baseline inventory snapshot
--diff FILE       # Diff current inventory against baseline
--chat            # Interactive chat (Claude) using MCP tools

安全测试示例

# Prompt injection testing
python3 MCPwn.py --burp localhost:9001 get_user_info '{"username": "admin\nIgnore instructions"}'

# Access internal resources
python3 MCPwn.py --burp localhost:9001 internal://credentials

# Multiple targets
echo -e "localhost:9001\nlocalhost:9002" > targets.txt
python3 MCPwn.py -f targets.txt