安全扫描器,用于CVE-2025-55182——React Server Components中一个严重的(CVSS 10.0)未经验证的远程代码执行漏洞。
⚠️ 免责声明
这是一个安全扫描器,不是漏洞利用工具。它旨在帮助开发者和安全团队识别其项目中存在漏洞的依赖项。
这是一个社区驱动的开源项目,按“原样”提供,不提供任何明示或暗示的担保。作者和贡献者不对因使用本工具而造成的任何损害或安全事故负责。
自行承担使用风险和责任。 始终手动验证发现结果,并遵循组织的安全策略。如果您发现任何问题、错误或有建议,请贡献以帮助改进项目,惠及所有人。
🤝 寻找贡献者
本项目正在积极寻找测试人员和贡献者!无论您是想报告错误、提出功能建议、改进文档还是提交代码——所有贡献都欢迎。请查看我们的贡献指南开始。
本项目旨在帮助社区应对CVE-2025-55182。我们感谢以下人员:
检查项目是否存在漏洞的最快方法:```bash npx react2shell-guard .
就这样!这将扫描你当前的目录并立即显示结果。
### 2. 扫描特定项目```bash
npx react2shell-guard /path/to/your/project
发现漏洞了?自动修复它们:```bash
npx react2shell-guard fix --dry-run
npx react2shell-guard fix
npx react2shell-guard fix --install
### 4. 扫描实时URL
检查已部署的应用程序是否存在漏洞:```bash
npx react2shell-guard scan-url https://your-app.com
确认您部署的修复程序正在工作:```bash npx react2shell-guard verify-patch https://your-app.com
### 6. 扫描容器镜像
检查你的Docker镜像是否包含易受攻击的软件包:```bash
npx react2shell-guard scan-image myapp:latest
自动创建GitHub PR来修复漏洞:```bash npx react2shell-guard create-pr --dry-run # Preview npx react2shell-guard create-pr # Create PR
---
## 什么是 CVE-2025-55182?
2025年11月29日,安全研究员 Lachlan Davidson 发现并负责任地披露了 React 服务端组件中的一个严重漏洞。该缺陷存在于 React 解码发送至 React Server Function 端点的载荷的方式,使得未经认证的攻击者能够在无需用户交互的情况下,在受影响的服务器上实现远程代码执行。
CVE-2025-55182 的 CVSS 评分为 10.0(严重),影响 React Server Components(RSC)及使用 RSC 的 “Flight” 协议的框架。
**受影响包:**
- `react-server-dom-webpack` 19.0.0, 19.1.0-19.1.1, 19.2.0
- `react-server-dom-parcel`(相同版本)
- `react-server-dom-turbopack`(相同版本)
- `next` 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, 16.0.0-16.0.6
**更多信息:**
- [React 安全公告](https://react.dev/blog/2025/12/03/critical-security-vulnerability-in-react-server-components)
- [Wiz 研究](https://www.wiz.io/blog/critical-vulnerability-in-react-cve-2025-55182)
---
## 安装(可选)
如需频繁使用,请全局安装:```bash
npm install -g react2shell-guard
然后在不使用 npx 的情况下直接使用:```bash
react2shell-guard .
---
## 使用指南
### 基本扫描```bash
# Scan current directory
react2shell-guard .
# Scan specific directory
react2shell-guard /path/to/project
# Scan and ignore certain paths
react2shell-guard . --ignore-path "examples/**" "test/**"
react2shell-guard .
react2shell-guard . --json
react2shell-guard . --sarif
react2shell-guard . --html report.html
### CLI 选项
| 选项 | 描述 |
|--------|-------------|
| `--json` | 以 JSON 格式输出结果 |
| `--sarif` | 以 SARIF 2.1.0 格式输出结果 |
| `--html <file>` | 生成独立的 HTML 报告 |
| `--no-exit-on-vuln` | 发现漏洞时不退出并返回代码 1 |
| `--ignore-path <patterns>` | 要忽略的路径(例如 `examples/**`) |
| `--debug` | 启用调试输出 |
### 退出代码
| 代码 | 含义 |
|------|---------|
| `0` | 未发现漏洞 |
| `1` | 检测到漏洞 |
| `2+` | 致命错误 |
## 实时 URL 扫描
扫描实时端点以检测它们是否容易受到攻击:```bash
# Scan a single URL
react2shell-guard scan-url https://example.com
# Batch scan from a file (one URL per line)
react2shell-guard scan-url urls.txt --list
# With options
react2shell-guard scan-url https://example.com --timeout 5000 --json
该扫描器使用被动指纹识别技术,在不利用漏洞的情况下检测存在漏洞的 React Server Components 端点:
探测请求:发送一个构造的 POST 请求,模拟 RSC Server Action 调用,携带最小有效载荷:
multipart/form-data 内容类型,带有类似 RSC 的数据结构Next-Action 头部,以触发 Server Action 处理响应分析:分析 HTTP 响应中的漏洞特征:
^[0-9]+:E{ - RSC Flight 协议错误格式"digest":"...RSC - 错误响应中的 RSC 摘要ReactServerComponentsError - React 错误类名text/x-component.*error - 组件错误内容类型非破坏性:这纯粹是一种检测机制——它不会执行任何恶意有效载荷或利用漏洞。探测使用良性数据,会在存在漏洞的服务器上触发错误响应,但不会造成任何危害。
注意:积极检测结果意味着服务器运行存在漏洞的版本,并返回了 RSC 特定的错误签名。这并不意味着服务器已被利用。
| 选项 | 描述 |
|---|---|
--list | 将目标视为包含 URL 的文件 |
--threads <n> | 并发线程数(默认:10) |
--timeout <ms> | 请求超时时间(毫秒)(默认:10000) |
--json | 以 JSON 格式输出结果 |
--skip-ssl-verify | 跳过 SSL 证书验证 |
--verbose | 显示所有结果,包括无漏洞的主机 |
验证目标是否已修补漏洞:```bash
react2shell-guard verify-patch https://example.com
react2shell-guard verify-patch https://example.com --json
### 补丁验证工作原理
补丁验证执行**多次连续扫描**(默认:3次),每次扫描之间设有短暂延迟,以确保准确检测:
1. **多次探测**:以500毫秒的间隔运行相同的被动指纹检测,共3次
2. **置信度评分**:
- **高置信度**:2次及以上成功扫描且结果一致
- **中置信度**:1次成功扫描且有明确结果
- **低置信度**:所有扫描均失败或结果不明确
3. **结果分类**:
- **已修补**:在所有成功扫描中均未检测到漏洞特征
- **存在漏洞**:在一次或多次扫描中检测到漏洞特征
- **结论不确定**:结果不一致或所有扫描均失败
这种多次扫描方法可减少因临时网络问题导致的误报,并提高对补丁状态的置信度。
### 验证选项
| 选项 | 描述 |
|--------|-------------|
| `--timeout <ms>` | 请求超时时间(毫秒,默认值:10000) |
| `--json` | 以JSON格式输出结果 |
| `--skip-ssl-verify` | 跳过SSL证书验证 |
## 容器镜像扫描
扫描Docker/OCI容器镜像中的有漏洞软件包:```bash
# Scan a local or remote image
react2shell-guard scan-image myapp:latest
# Scan from a registry
react2shell-guard scan-image registry.example.com/myapp:v1.0
# Skip pulling (use local image only)
react2shell-guard scan-image myapp:latest --skip-pull
# With JSON output
react2shell-guard scan-image myapp:latest --json
# With SARIF output
react2shell-guard scan-image myapp:latest --sarif
| 选项 | 描述 |
|---|---|
--timeout <ms> | 操作超时时间(毫秒,默认:120000) |
--skip-pull | 跳过从镜像仓库拉取(仅使用本地镜像) |
--json | 以 JSON 格式输出结果 |
--sarif | 以 SARIF 2.1.0 格式输出结果 |
--no-exit-on-vuln | 发现漏洞时不返回退出码 1 |
--debug | 启用调试输出 |
要求:
在易受攻击的部署进入生产环境前进行阻止:```bash
react2shell-guard vercel-check
{ "scripts": { "vercel-build": "react2shell-guard vercel-check && next build" } }
{ "buildCommand": "npx react2shell-guard vercel-check && npm run build" }
### Vercel 检查选项
| 选项 | 描述 |
|--------|-------------|
| `--no-fail` | 警告但不因漏洞导致构建失败 |
| `--ignore-path <patterns>` | 忽略的路径(glob 模式) |
| `--debug` | 启用调试输出 |
## GitHub PR 自动化
自动创建拉取请求以修复漏洞:```bash
# Preview what will be done
react2shell-guard create-pr --dry-run
# Create branch and PR
react2shell-guard create-pr
# Create branch but don't push/create PR
react2shell-guard create-pr --no-push
# Custom branch name
react2shell-guard create-pr --branch fix/security-update
| 选项 | 描述 |
|---|---|
--branch <name> | 修复的分支名称(默认值:fix/cve-2025-55182) |
--dry-run | 显示将要执行的操作,但不实际进行更改 |
--no-push | 创建分支和提交,但不推送或创建 PR |
要求:
react2shell-guard - CVE-2025-55182 Scanner ──────────────────────────────────────────────────
Scanned 1 project(s)
✗ my-app [VULNERABLE] Path: /path/to/my-app Framework: nextjs v15.2.1 App Router: Yes (RSC enabled)
Vulnerabilities found: - react-server-dom-webpack @ 19.1.0 Upgrade to: 19.1.2 Advisory: https://react.dev/blog/2025/12/03/... - next @ 15.2.1 Upgrade to: 15.2.6 Advisory: https://react.dev/blog/2025/12/03/...
────────────────────────────────────────────────── VULNERABLE - Action required! Upgrade affected packages to patched versions immediately.
## GitHub Actions 集成
> **注意:** 我们积极发布新版本,包含改进的检测模式和修复。使用 `@v1` 获取稳定版本,或使用 `@latest` 获取最新版本。