run-code MCP 工具实现未授权远程代码执行CVE-2026-5029 的概念验证(PoC)利用程序——Code Runner MCP Server 中的一个严重未授权远程代码执行漏洞,当服务器以
--transport http运行时,可通过run-codeMCP 工具触发。
Code Runner MCP Server 在通过 --transport http 标志启动时,会在 3088 端口上暴露一个 JSON-RPC /mcp 端点。该端点可在零认证情况下访问——无需 API 密钥、无需会话令牌、无需来源检查。
任何能够访问该端口的未授权远程攻击者都可以直接调用 run-code MCP 工具。该工具接受任意源代码和语言标识符,将其写入临时文件,并通过 child_process.exec() 使用相应的解释器(bash、python、powershell 等 30 多种)执行。
由于 code 参数在任何阶段都未经过滤处理,攻击者能够以运行 MCP 服务器的进程权限实现完全未授权的远程代码执行。
┌──────────┐ JSON-RPC tools/call ┌───────────────────────┐ exec() ┌──────────┐
│ Attacker │ ──── run-code tool ─────▶│ /mcp (port 3088) │ ─────────▶ │ RCE │
│ │ (no auth needed) │ Code Runner MCP │ │ on Host │
└──────────┘ └───────────────────────┘ └──────────┘
/mcp 端点,枚举可用的 MCP 工具run-code 工具的输入 schema(code、languageId)code 的精心构造的 tools/call JSON-RPC 请求code 写入临时文件,并通过所选解释器执行.
├── exploit.py # 🎯 Interactive RCE exploit shell (Rich-based terminal UI)
└── README.md # 📖 You are here
exploit.py — 交互式漏洞利用主要漏洞利用脚本,专为安全评估和案例研究中的专业用途而构建。脚本会连接到目标 MCP 服务器并进入交互式 Shell,任何命令都会通过存在漏洞的 run-code 工具实时执行。
功能包括:
-l 选择执行语言(默认为 shellscript)pip 包管理器# Clone the repository
git clone https://github.com/0x00phantom-hat/CVE-2026-5029-Exploit.git
cd CVE-2026-5029-RCE-Exploit
# Install dependencies
pip install fastmcp rich
# Drop into an interactive RCE shell (default: shellscript)
python3 exploit.py -u http://TARGET:3088/mcp
# Use a specific language interpreter
python3 exploit.py -u http://TARGET:3088/mcp -l python
# List all languages the MCP server advertises support for
python3 exploit.py -u http://TARGET:3088/mcp --available
# Probe which language runtimes are actually installed on the target
python3 exploit.py -u http://TARGET:3088/mcp --installed -v
# Show the help menu
python3 exploit.py -h
连接成功后,漏洞利用程序会进入交互式提示符:
PhantomHat-MCP@Exploit-CVE-2026-5029 $ id
输入 exit 关闭会话。
--transport http——请使用默认的 stdio 传输方式127.0.0.1,并将其置于经过身份验证的反向代理或 VPN 之后run-code 调用和不寻常的子进程本工具仅用于经授权的安全测试和教育目的。
未经授权访问计算机系统属于违法行为,违反的法律包括《计算机欺诈与滥用法》(CFAA)、《计算机滥用法》以及全球范围内的类似法规。作者对本软件的滥用不承担任何责任。
仅可对您拥有或已获得明确书面授权的系统使用本工具。
作者: Phantom Hat
仅限经授权的渗透测试与安全研究使用。
| 属性 | 详情 |
|---|
| CVE 编号 | CVE-2026-5029 |
| CVSS 评分 | 8.7 / 10 — 高危 |
| CWE | CWE-306 — 关键功能缺少身份验证 |
| 受影响产品 | Code Runner MCP Server |
| 受影响版本 | (未修复)所有通过 --transport http 暴露 run-code 工具的版本 |
| 身份验证 | 无需身份验证(未授权) |
| 补丁状态 | 未修复 |
| 发现者 | Phantom Hat |
| 参数 | 描述 | 默认值 |
|---|
-u, --url | (必需) MCP 服务器 URL | — |
-l, --language | 用于代码执行的语言 | shellscript |
-a, --available | 列出所有受支持的语言 | 标志 |
-i, --installed | 探测目标上已安装的语言运行时 | 标志 |
-v, --verbose | 详细输出模式 | 标志 |
-h, --help | 显示帮助菜单 | — |
| 阶段 | 名称 | 描述 |
|---|
| 1 | 🔍 枚举 | 连接到 /mcp 并枚举可用的 MCP 工具 |
| 2 | 🧪 Schema 发现 | 确认 run-code 的输入 schema(code、languageId) |
| 3 | 💣 漏洞利用投递 | 发送包含攻击者控制的代码的精心构造的 tools/call 请求 |
| 4 | 🚀 交互式执行 | 进入实时 Shell——每条命令都在目标主机上执行 |