协议安全扫描工具

MCPReconX是一个针对Model Context Protocol(MCP)服务器的全面安全评估工具包,提供CVE检测、网络扫描、攻击模式识别和工作漏洞利用功能。

  • by Habibeprojects
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 Habibeprojects/MCPReconX

使用说明

MCPReconX v2.0-模型上下文协议安全扫描程序

Complete security assessment toolkit for Model Context Protocol (MCP) servers

🔍 CVE Detection | 🌐 Internet Scanning | 📊 Attack Patterns | 🛠️ Working Exploits


⚠️ 道德使用通知

MCPReconX仅用于授权的安全测试。 使用此工具即表示您同意 免责声明未经授权访问计算机系统是非法的。


特征

🔍 CVE检测

检测10多个已知的MCP漏洞:

CVE 描述 CVSS
CVE-2025-49596 MCP检查员未经身份验证的RCE 9.4
CVE-2025-6514 mcp远程操作系统命令注入 9.6
CVE-2025-68143 Git MCP路径遍历 8.8
CVE-2025-68144 Git MCP参数注入 8.1
CVE-2025-68145 Git MCP路径验证旁路 7.1
CVE-2025-66416 Python SDK中的DNS重新绑定 7.6
CVE-2025-6515 会话劫持(oatpp-mcp) 8.2
CVE-2025-65513 获取mcp SSRF 8.5
CVE-2025-53967 帧链接图RCE 9.1
CVE-2025-5276 标记SSRF 7.5

🌐 发现模式

  • GitHub发现:在GitHub存储库上查找MCP服务器
  • 互联网扫描:扫描主机/网络以查找暴露的MCP服务器
  • 本地发现:自动检测本地MCP服务器

📊 攻击模式检测

基于 Adversa.ai的MCP安全25强:

  • 工具中毒攻击(TPA)
  • 全模式中毒(FSP)
  • 高级工具中毒(ATPA)
  • 困惑的副攻击
  • 通证
  • Rug Pull攻击
  • 邻居杰克(0.0.0.0天)
  • DNS重新绑定

🛠️ 工作MCP客户端

完整的MCP协议实施:

  • HTTP/SSE传输
  • WebSocket传输
  • 工具调用
  • 资源访问
  • 及时处理

安装

# Clone the repository
git clone https://github.com/security/mcpreconx.git
cd mcpreconx

# Install dependencies
pip install -r requirements.txt

# Or use the installer
chmod +x install.sh
./install.sh

快速开始

1.扫描本地MCP服务器

# Basic scan
python main.py --target http://localhost:3000/sse

# Full security assessment
python main.py -t http://localhost:3000/sse --cve-check --detect-patterns --report-all

# With authentication
python main.py -t http://localhost:3000/sse --auth-token "Bearer YOUR_TOKEN"

2.在GitHub上发现MCP服务器

# Search GitHub for MCP servers
python main.py --discover-github

# With GitHub token (higher rate limits)
python main.py --discover-github --github-token YOUR_GITHUB_TOKEN

# Limit results
python main.py --discover-github --max-results 100

3.扫描互联网以查找暴露的MCP服务器

# Scan a single host
python main.py --discover-internet --target scanme.nmap.org

# Scan a network range
python main.py --discover-internet --target 192.168.1.0/24

# ⚠️ Only scan networks you own or have permission to test!

4.使用MCP客户端进行测试

import asyncio
from modules.mcp_client import MCPClient

async def test_mcp():
    async with MCPClient("http://localhost:3000/sse") as client:
        # Initialize connection
        if await client.initialize():
            print("Connected to MCP server!")
            
            # List tools
            tools = await client.list_tools()
            print(f"Available tools: {len(tools)}")
            
            # Call a tool
            result = await client.call_tool("example_tool", {"param": "value"})
            print(f"Result: {result}")

asyncio.run(test_mcp())

CLI参考

目标规范

-t, --target          Target MCP server URL
--method              Transport: auto, http, websocket

发现模式

--discover-github     Discover MCP servers on GitHub
--discover-internet   Discover MCP servers on internet
--github-token        GitHub API token
--max-results         Maximum results (default: 50)

扫描选项

--cve-check           Enable CVE detection
--detect-patterns     Enable attack pattern detection
--risk                Risk level: low, medium, high
--level               Scan intensity 1-5
--safe                Safe mode (default)
--exploit             Enable exploitation simulation

输出选项

-v, --verbose         Verbose output (-vv for debug)
--json                Generate JSON report
--pdf                 Generate PDF report
--report-all          Generate all reports
--output-dir          Output directory (default: reports)

例子

全面安全评估

# Comprehensive scan with all checks
python main.py \
  --target http://localhost:3000/sse \
  --cve-check \
  --detect-patterns \
  --risk high \
  --report-all \
  -v

GitHub研究

# Find popular MCP servers
python main.py --discover-github --max-results 100

# Analyze specific repositories
python main.py --discover-github | jq '.servers[] | select(.stars > 100)'

网络扫描

# Scan your local network
python main.py --discover-internet --target 192.168.1.0/24

# Scan common MCP ports on a host
python main.py --discover-internet --target localhost

批次扫描

# Scan multiple targets from file
for target in $(cat targets.txt); do
  python main.py --target "$target" --batch --json
done

建筑

MCPReconX/
├── main.py                    # CLI entry point
├── config.yaml               # Configuration with CVE signatures
├── requirements.txt          # Dependencies
├── install.sh               # Installation script
│
├── modules/                  # Core modules
│   ├── mcp_client.py        # Working MCP protocol client
│   ├── github_discovery.py  # GitHub MCP server discovery
│   ├── internet_discovery.py # Internet scanning
│   ├── cve_detector.py      # CVE detection engine
│   ├── attack_patterns.py   # Attack pattern detection
│   ├── scanner.py           # Active vulnerability scanning
│   ├── fingerprint.py       # Server fingerprinting
│   ├── detect_poison.py     # Tool poisoning detection
│   ├── exploit_sim.py       # Exploitation simulation
│   ├── report.py            # Report generation
│   └── utils.py             # Utilities
│
├── exploits/                 # PoC exploit templates
├── tampers/                  # Evasion scripts
├── logs/                     # Scan logs
└── reports/                  # Generated reports

扫描流水线

┌─────────────────┐
│  1. Discovery   │ → GitHub/Internet/Local
└────────┬────────┘
         ▼
┌─────────────────┐
│  2. Validation  │ → Protocol detection
└────────┬────────┘
         ▼
┌─────────────────┐
│  3. Fingerprint │ → Implementation, version
└────────┬────────┘
         ▼
┌─────────────────┐
│  4. CVE Check   │ → Match known CVEs
└────────┬────────┘
         ▼
┌─────────────────┐
│  5. Patterns    │ → Attack pattern detection
└────────┬────────┘
         ▼
┌─────────────────┐
│  6. Active Scan │ → Vulnerability testing
└────────┬────────┘
         ▼
┌─────────────────┐
│  7. Exploit Sim │ → PoC simulation
└────────┬────────┘
         ▼
┌─────────────────┐
│  8. Reporting   │ → JSON/PDF reports
└─────────────────┘

报告示例

控制台输出

======================================================================
MCPReconX Security Assessment Report
======================================================================
Target: http://localhost:3000/sse
Risk Rating: CRITICAL
Duration: 45.23 seconds
Safe Mode: Yes

CVEs Detected:
  [CRITICAL] CVE-2025-49596: MCP Inspector Unauthenticated RCE (CVSS: 9.4)
  [HIGH] CVE-2025-66416: DNS Rebinding Vulnerability (CVSS: 7.6)

Attack Patterns:
  [CRITICAL] Tool Poisoning Attack (TPA)
  [HIGH] Full Schema Poisoning (FSP)
  [MEDIUM] Excessive Agency

Vulnerabilities:
  Critical: 2
  High: 3
  Medium: 2
  Low: 1

Top Issues:
  - CVE-2025-49596: Unauthenticated RCE in MCP Inspector
  - Tool Poisoning in 'execute_code' tool
  - SSRF vulnerability in 'fetch_url' tool
======================================================================

JSON报告

{
  "report_metadata": {
    "tool": "MCPReconX",
    "version": "2.0.0",
    "generated_at": "2024-01-15T10:30:00"
  },
  "executive_summary": {
    "overall_risk_rating": "CRITICAL",
    "cves_detected": 2,
    "attack_patterns": 3,
    "vulnerabilities_found": 7
  },
  "cve_findings": [
    {
      "cve_id": "CVE-2025-49596",
      "name": "MCP Inspector Unauthenticated RCE",
      "cvss_score": 9.4,
      "severity": "critical"
    }
  ],
  "attack_patterns": [
    {
      "pattern_name": "Tool Poisoning Attack (TPA)",
      "severity": "critical",
      "affected_component": "tool:execute_code"
    }
  ],
  "scan_details": { ... }
}

研究来源


贡献

欢迎投稿!拜托:

  1. 分叉存储库
  2. 创建要素分支
  3. 进行更改
  4. 如果适用,添加测试
  5. 提交拉取请求

许可证

MIT许可证-请参阅 许可证 文件


🔒 Secure MCP. Safe AI. Ethical Testing. 🔒