InferiorAK/CVE-2025-55182-React2Shell-Async-Scanner

GitHub: InferiorAK/CVE-2025-55182-React2Shell-Async-Scanner

针对 CVE-2025-55182 与 CVE-2025-66478 的异步 RCE 扫描器,利用 React Server Actions 原型链污染实现零误报的 Canary 回显验证。

Stars: 0 | Forks: 0

# ⚡ React2Shell ### CVE-2025-55182 / CVE-2025-66478 - 异步 RCE 扫描器 [![Python](https://img.shields.io/badge/Python-3.10%2B-blue?style=flat-square&logo=python)](https://python.org) [![CVE](https://img.shields.io/badge/CVE-2025--55182-red?style=flat-square)](https://nvd.nist.gov/vuln/detail/CVE-2025-55182) [![CVE](https://img.shields.io/badge/CVE-2025--66478-red?style=flat-square)](https://nvd.nist.gov/vuln/detail/CVE-2025-66478) [![License](https://img.shields.io/badge/License-MIT-green?style=flat-square)](LICENSE) [![Author](https://img.shields.io/badge/Author-InferiorAK-orange?style=flat-square)](https://github.com/InferiorAK) **原型链污染 → 通过 React Server Actions 实现远程代码执行** *异步、版本优先、基于输出且无需盲目猜测的 Canary 验证机制*
## 目录 - [漏洞概述](#vulnerability-overview) - [受影响版本](#affected-versions) - [检测原理](#how-detection-works) - [安装说明](#installation) - [使用方法](#usage) - [参数参考](#options-reference) - [输出与判定结果](#output--verdicts) - [浏览器模式](#browser-mode) - [版本检测流程](#version-detection-pipeline) ## 漏洞概述 React Server Actions 将 action 数据作为 **multipart form data** 直接传递到服务端执行上下文中。由于受影响版本的 `react-server-dom-webpack` 对原型链污染的清理不足,攻击者可以: 1. 注入精心构造的 multipart payload 以污染 `Object.prototype` 2. 覆盖内部响应对象上的 `_response._prefix` 3. 通过以下方式强制服务器执行任意 shell 命令: process.mainModule.require('child_process').execSync(cmd) 这使得任何使用 React Server Actions 且 React 版本受影响的公开 Next.js 应用面临 **未经身份验证的远程代码执行** 风险。 **CVE-2025-55182** - 广义:影响 React 19 软件包(`react-server-dom-webpack`、`react-server-dom-parcel`、`react-server-dom-turbopack`) **CVE-2025-66478** - 严格:通过 `/` Server Action 端点进行的 Next.js 特定利用路径 ## 受影响版本 | 组件 | 受影响版本 | 已修复版本 | |-----------|-----------|---------| | **React** `react-server-dom-*` | `19.0.0`, `19.1.0`, `19.1.1`, `19.2.0` | `19.0.1`, `19.1.2`, `19.2.1+` | | **Next.js 16.x** | `16.0.0` – `16.0.6` | `16.0.7+` | | **Next.js 15.x** | `15.0.0-15.0.4`, `15.1.0-15.1.8`, `15.2.0-15.2.5`, `15.3.0-15.3.5`, `15.4.0-15.4.7`, `15.5.0-15.5.6` | `15.0.5+`, `15.1.9+`, `15.2.6+`, `15.3.6+`, `15.4.8+`, `15.5.7+` | | **Next.js 14.x** | `14.3.0-canary.77+` 仅限 canary 构建 | 所有稳定版 14.x - **不受影响** | | **Next.js 13.x** | - | **不受影响** | ## 检测原理 本扫描器采用 **基于输出的 Canary 验证** —— 这是确认真实代码执行最可靠的方法,可实现零误报: ``` 1. POST / with Next-Action header + multipart prototype-pollution payload 2. Payload executes: echo 3. Vulnerable server throws NEXT_REDIRECT with base64(canary) in the URL 4. Response header: X-Action-Redirect: /login?a= 5. Scanner decodes base64 → matches canary → RCE confirmed ✓ ``` `allow_redirects=False` 至关重要 —— 确认信息位于 **header** 中,而非重定向目标。 ## 安装说明 ``` git clone https://github.com/InferiorAK/React2Shell cd React2Shell pip install -r requirements.txt # 仅在 --browser 模式下用于改进版本检测时需要: playwright install chromium ``` **要求:** Python 3.10+ ## 使用方法 ### CVE-2025-55182 扫描器 - 广义(React + Next.js) ``` # 单个目标 python3 CVE-2025-55182_scanner.py -u https://target.com # 扫描 URL 列表 python3 CVE-2025-55182_scanner.py -f urls.txt # 静默模式 - 仅输出 RCE / Vulnerable 结果 python3 CVE-2025-55182_scanner.py -f urls.txt -q # Browser 模式 - 使用无头 Chromium 进行精确版本检测 python3 CVE-2025-55182_scanner.py -f urls.txt -b # 完整选项 - 推荐用于大规模扫描 python3 CVE-2025-55182_scanner.py -f urls.txt -b -q -c 3 -t 20 ``` ## 参数参考 ### CVE-2025-55182 扫描器 | 标志 | 完整参数 | 默认值 | 描述 | |------|-----------|---------|-------------| | `-u` | `--url` | - | 单个目标 URL | | `-f` | `--file` | - | 包含 URL 列表的文件(每行一个) | | `-o` | `--output` | `outputs/vuln.txt` | 存在漏洞的目标输出文件 | | `-U` | `--unknown-output` | `outputs/unknown.txt` | 版本未知的目标输出文件 | | `-c` | `--concurrency` | `5` | 并发 HTTP 连接数 | | `-t` | `--timeout` | `15` | 单次请求超时时间(秒) | | `-q` | `--quiet` | off | 仅打印 `RCE` / `VULNERABLE` 行 | | `-b` | `--browser` | off | Playwright 无头 Chromium 版本检测回退 | ## 输出与判定结果 每个扫描的目标将被分配以下判定结果之一:
| 判定 | 颜色 | 含义 | |---------|-------|---------| | `RCE` | 🔴 红色 | 在 `X-Action-Redirect` 中确认 Canary —— **已证实远程代码执行** | | `VULNERABLE` | 🟠 橙色 | 版本处于受影响范围内;RCE payload 未回显(WAF / 配置已修补 / 端点错误) | | `Unknown` | 🟡 黄色 | 已确认 Next.js 但无法检测版本 —— 仍尝试 RCE;保存至 `outputs/unknown.txt` 以便浏览器模式重试 | | `Not Vulnerable` | 🟢 绿色 | 版本确认为已修补,或 RCE 明确返回安全 | | `Skipped` | ⚪ 白色 | 确认已修补的版本或非 Next.js 站点 —— 未尝试 PoC | | `Error` | ⚪ 白色 | 主机不可达或连接失败 | **输出文件**(保存至 `outputs/` 文件夹,自动创建): - `outputs/vuln.txt` —— `RCE` 和 `VULNERABLE` 结果(每次运行追加) - `outputs/unknown.txt` —— 版本 `Unknown` 的目标;使用 `-b` 重试这些目标以进行精确版本检测 ## 浏览器模式 使用 **App Router** 架构的现代 Next.js 13+ 绝不会在静态 HTML 中嵌入框架版本。该版本仅存在于 `window.next.version` 中,**需在真实浏览器上下文中执行 JavaScript 后**才能获取。 不使用 `--browser` 时: - 版本检测依赖于 HTTP header、`__NEXT_DATA__`、内联脚本和哈希块文件 - App Router 站点几乎总是返回 `unknown` —— 基于版本的过滤被绕过 使用 `--browser` (`-b`) 时: - Playwright 启动无头 Chromium - 页面 JavaScript 完全执行 - 扫描器直接从实时 DOM 读取 `window.next.version` - 版本准确率在现代 Next.js 站点上从约 10% 提升至接近 100% ``` # 推荐搭配 browser 模式 - 降低并发 (browser 页面资源占用高) python3 CVE-2025-55182_scanner.py -f urls.txt -b -c 3 ``` ## 版本检测流程 扫描器最多运行 **7 个阶段**,一旦发现版本即停止: ``` Stage 1 │ HTTP Response Headers │ X-Powered-By: Next.js X.Y.Z │ x-nextjs-*, x-next-version Stage 2 │ Inline