sahiloj/MCPScan
GitHub: sahiloj/MCPScan
首个针对 MCP 服务器的专用攻击性安全审计工具,检测工具投毒、凭证泄露、RCE、SSRF 等 8 类威胁并关联已知 CVE 漏洞
Stars: 0 | Forks: 0
首个针对 MCP 服务器的专用攻击安全审计器
威胁格局 · 检查项 · 安装 · 使用 · CVEs · 输出
``` MCPScan — Offensive MCP Server Auditor ────────────────────────────────────────────────────────── Server: filesystem-server (stdio: npx @modelcontextprotocol/server-filesystem /home) Enumerated: 12 tools · 0 resources · 0 prompts CRITICAL MCP-701 RCE Vector: Shell/Execution Parameter Name Location: tool: bash_exec > inputSchema Evidence: Dangerous params: command, args CVE: CVE-2025-6514 (CVSS 9.6) Fix: Use allowlists; never pass raw input to shell functions HIGH MCP-304 Overprivileged: Unrestricted Filesystem Path Parameter Location: tool: write_file > inputSchema Evidence: Tool: write_file, capabilities: fs-write Fix: Add a path allow-list restricting access to approved directories HIGH MCP-202 Credential Leak: Anthropic API Key Location: tool: call_llm > description Evidence: sk-ant-api03-•••••••••••••••• Fix: Rotate immediately. Never embed secrets in tool metadata. ╭──────────────── MCPScan Results ─────────────────╮ │ │ │ Scanned 3 servers · Enumerated in 4.2s │ │ 2 critical · 5 high · 1 medium · 1 low │ │ │ ╰───────────────────────────────────────────────────╯ ``` ## 🔥 威胁格局 MCP 已成为连接 AI 代理与现实世界的标准 —— 而攻击者已率先抵达。研究人员已记录: | 威胁 | 影响 | 规模 | |---|---|---| | **Tool Poisoning (工具投毒)** | 隐藏指令劫持 LLM 行为 | 攻击成功率 >72% | | **通过 mcp-remote 实现远程代码执行 (RCE)** | 完整的操作系统命令执行 | 受影响开发者约 500,000 人 | | **暴露的服务器** | 未经认证即可访问工具和数据 | 发现 492+ 台公开服务器 | | **凭证泄露** | API 密钥嵌入在工具元数据中 | 数千次安装 | | **供应链** | 受损的 npm 包生成恶意 MCP 模块 | 正在野外活跃利用 | 此前不存在专用的攻击性扫描器。**MCPScan 填补了这一空白。** ## 🔍 检查项 MCPScan 运行 **8 个检查类别**,覆盖完整的 MCP 攻击面: | ID | 类别 | 检测内容 | |---|---|---| | MCP-1xx | `tool-poisoning` | 隐藏的 Unicode(零宽字符、RTL 重写)、HTML/XML 注入、提示词注入关键词、base64 载荷、超长描述、Markdown 数据窃取 | | MCP-2xx | `credential-leak` | AWS 密钥、API Token(Anthropic, OpenAI, GitHub, Stripe, Slack)、JWT、私钥、数据库连接字符串 | | MCP-3xx | `overprivileged` | Shell+文件系统组合、Shell+网络组合、不受限制的路径参数、代码执行(eval)、敏感路径访问(`~/.ssh`, `~/.aws`) | | MCP-4xx | `auth-missing` | 未认证的服务器枚举、CORS 通配符、`0.0.0.0` 绑定、缺失的安全标头 | | MCP-5xx | `session-hijack` | URL 参数中的会话 ID、可预测/基于时间的 ID、缺失 `Secure`/`HttpOnly` Cookie 标志 | | MCP-6xx | `ssrf` | 用户提供的 URL 参数、Webhook/回调端点、带变量的 HTTP 资源 URI 模板 | | MCP-7xx | `rce-vectors` | `command`/`exec`/`eval` 参数名称、描述中的执行语言、净化声明检测 | | MCP-8xx | `supply-chain` | CVE 版本范围、缺失的 lockfiles、抢注(typosquatted)的 MCP 包名 | ### 📋 CVE 参考 | CVE | 软件包 | CVSS | 摘要 | |---|---|---|---| | [CVE-2025-6514](https://jfrog.com/blog/2025-6514-critical-mcp-remote-rce-vulnerability/) | `mcp-remote` | **9.6** | 任意操作系统命令执行 —— 首个通过 MCP 实现的完整系统入侵 | | [CVE-2025-49596](https://nvd.nist.gov/vuln/detail/CVE-2025-49596) | `@modelcontextprotocol/inspector` | **9.4** | 通过 inspector-proxy 实现的未认证 RCE | | [CVE-2025-59536](https://research.checkpoint.com) | `@anthropic-ai/claude-code` | **9.1** | 项目文件 RCE + API Token 窃取 | | [CVE-2025-53967](https://nvd.nist.gov/vuln/detail/CVE-2025-53967) | `figma-developer-mcp` | **8.2** | 通过 Shell 字符串插值实现的命令注入 | | [CVE-2026-25536](https://nvd.nist.gov/vuln/detail/CVE-2026-25536) | `@modelcontextprotocol/sdk` | **7.5** | StreamableHTTP 跨客户端数据泄露 (v1.10.0–1.25.3) | ## ⚡ 安装 **需要 Node.js ≥ 18** ``` git clone https://github.com/sahiloj/MCPScan.git cd MCPScan npm install npm run build ``` 全局链接并从任意位置运行: ``` npm link mcpscan --help ``` ## 🚀 使用 ### 扫描 stdio 服务器 ``` mcpscan scan --command "npx" --args "-y @modelcontextprotocol/server-filesystem /home/user" ``` ### 从您的 AI 客户端配置扫描 ``` # Claude Desktop (macOS) mcpscan scan --config ~/Library/Application\ Support/Claude/claude_desktop_config.json # 自动发现所有已知 config 位置 (Claude, Cursor, 等) mcpscan scan --all-configs ``` ### 扫描远程 HTTP / SSE 服务器 ``` mcpscan scan --target http://localhost:3000/mcp ``` ### 扫描本地主机以发现暴露的 MCP 服务器 ``` mcpscan scan --all-configs --network ``` ### 仅运行指定检查 ``` mcpscan scan --all-configs --checks tool-poisoning,credential-leak,rce-vectors ``` ### 严重性过滤 ``` # 仅报告 high 和 critical mcpscan scan --all-configs --severity high ``` ### CI/CD 集成 ``` # Exit code 2 = critical 发现, exit code 1 = high 发现 mcpscan scan --all-configs --severity high --output sarif > findings.sarif ``` ### 仅发现不扫描 ``` mcpscan discover --all-configs --network mcpscan discover --all-configs --output json ``` ## ⚙️ 所有选项 ``` mcpscan scan [options] -c, --config- Comma-separated checks to run (default: all)
-o, --output
基于 MIT License 发布 · 为安全社区构建
标签:CISA项目, CVE 检测, LLM 安全, LNA, MCP Server, MCP 安全, MITM代理, Model Context Protocol, PE 加载器, Python 安全工具, RCE 检测, SSRF 检测, 云安全监控, 会话劫持, 凭据泄露, 大模型安全, 安全测试, 工具投毒, 攻击性安全, 端点安全, 网络安全, 自动化攻击, 补丁管理, 隐私保护, 静态分析