React 服务端组件中的 CVSS 10.0 RCE。你的 React 19 应用存在漏洞吗?
用于检测 CVE-2025-55182(React2Shell)的快速、精准扫描器——这是一个已被在野利用的严重远程代码执行漏洞。凭借智能的服务端组件检测实现零误报。
React2Shell 是 React 服务端组件中的一个**最高严重级别(CVSS 10.0)**漏洞,允许未经身份验证的远程代码执行。攻击者可通过向服务端函数端点发送特制的 HTTP 请求来利用此漏洞。
关键信息:
⚠️ 重要说明: 只有 React 19.x 易受攻击。React 18.x 及更早版本不受影响。
# Option A: Node.js scanner (recommended - cross-platform, no dependencies)
npx react2shell-scanner /path/to/your/project
# Option B: Direct download and run
curl -sSL https://raw.githubusercontent.com/nxgn-kd01/react2shell-scanner/main/scan.js > scan.js
node scan.js /path/to/your/project
# Option C: Clone and run
git clone https://github.com/nxgn-kd01/react2shell-scanner.git
cd react2shell-scanner
node scan.js /path/to/your/project
数秒内出结果: 🚨 存在漏洞 | ⚠️ 存在警告 | ✅ 安全
该工具执行智能漏洞检测:
'use server' 指令React:
19.0.0、19.1.0、19.1.1、19.2.0React Server DOM 包:
react-server-dom-webpack 19.0.0 - 19.2.0react-server-dom-parcel 19.0.0 - 19.2.0react-server-dom-turbopack 19.0.0 - 19.2.0Next.js:
14.0.0 至 14.2.3414.3.0-canary.0 至 14.3.0-canary.8715.0.0 至 15.0.615.1.0 至 15.1.815.2.0 至 15.2.515.3.0 至 15.3.515.4.0 至 15.4.715.5.0 至 其他受影响框架(根据 React 官方公告):
react-router 7.0.0 - 7.1.3waku 0.21.0 - 0.21.5@parcel/rsc 2.12.0 - 2.13.2@vitejs/plugin-rsc 0.1.0 - 0.2.0rwsdk(Redwood SDK)0.1.0 - 0.4.0expo 52.0.0 - 52.0.9React: 19.2.1 或更高版本
Next.js:
14.2.35+、14.3.0-canary.88+15.0.7+、15.1.9+、15.2.6+、15.3.6+、15.4.8+、15.5.7+16.0.10+其他框架:
react-router:7.1.4+waku:0.21.6+@parcel/rsc:2.13.3+@vitejs/plugin-rsc:0.2.1+rwsdk:0.4.1+expo:52.0.10+Node.js 扫描器(推荐):
Bash 扫描器:
# Install jq (if using Bash scanner)
# macOS
brew install jq
# Ubuntu/Debian
sudo apt-get install jq
# RHEL/CentOS
sudo yum install jq
选项 A:克隆(推荐普通用户)
# Clone the repository
git clone https://github.com/nxgn-kd01/react2shell-scanner.git
cd react2shell-scanner
# Make scripts executable
chmod +x scan.sh scan.js
选项 B:Fork(推荐贡献者)
# Fork on GitHub (click "Fork" button on repository page)
# Then clone your fork
git clone https://github.com/YOUR_USERNAME/react2shell-scanner.git
cd react2shell-scanner
# Make scripts executable
chmod +x scan.sh scan.js
# Add upstream remote to stay updated
git remote add upstream https://github.com/nxgn-kd01/react2shell-scanner.git
选项 C:直接下载
# Node.js version (recommended - cross-platform)
curl -O https://raw.githubusercontent.com/nxgn-kd01/react2shell-scanner/main/scan.js
chmod +x scan.js
# Bash version (Unix/Linux/macOS only)
curl -O https://raw.githubusercontent.com/nxgn-kd01/react2shell-scanner/main/scan.sh
chmod +x scan.sh
🔍 扫描当前目录:
# Using Node.js (recommended)
node scan.js
# Using Bash
./scan.sh
📁 扫描指定项目:
node scan.js /path/to/project
./scan.sh /path/to/project
🗂️ 递归扫描(所有子目录):
node scan.js -r
./scan.sh -r
JSON 输出(用于自动化):
node scan.js --json
./scan.sh --json
CI/CD 模式(存在漏洞时以退出码 1 退出):
node scan.js --ci
./scan.sh --ci
详细输出:
node scan.js -v
./scan.sh -v
组合选项:
node scan.js /path/to/projects -r --json --ci
./scan.sh /path/to/projects -r --json --ci
| 代码 | 含义 |
|---|---|
| 0 | 未发现漏洞 |
| 1 | 发现漏洞(使用 --ci 标志时) |
| 2 | 发生扫描错误 |
$ node scan.js ~/my-react-app
╔════════════════════════════════════════════════════════════╗
║ CVE-2025-55182 Scanner (React2Shell) ║
╚════════════════════════════════════════════════════════════╝
Severity: CRITICAL (CVSS 10.0)
Description: Unauthenticated RCE in React Server Components
Scan Summary:
Total projects: 1
Vulnerable: 1
Safe: 0
⚠ VULNERABLE PROJECTS FOUND:
1. /Users/user/my-react-app
└─ react 19.0.0 → 19.2.1
└─ next 15.0.3 → 15.0.5
Fix command:
$ cd /Users/user/my-react-app
$ npm install [email protected] [email protected]
$ node scan.js ~/projects -r --json > results.json
{
"vulnerability": "CVE-2025-55182",
"severity": "CRITICAL",
"cvss": 10.0,
"scanned": 5,
"vulnerable": 2,
"results": [
{
"path": "/Users/user/projects/app1",
"vulnerable": true,
"packages": [
{
"name": "react",
"version": "19.0.0",
"fixVersion": "19.2.1"
}
],
"packageManager": "npm",
"fixCommands": [
"cd /Users/user/projects/app1",
"npm install [email protected]"
]
}
]
}
.github/workflows/security-scan.yml
name: CVE-2025-55182 Security Scan
on: [push, pull_request]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Download CVE-2025-55182 Scanner
run: |
curl -O https://raw.githubusercontent.com/nxgn-kd01/cve-2025-55182-scanner/main/scan.js
chmod +x scan.js
- name: Scan for vulnerabilities
run: node scan.js --ci
GitLab CI(.gitlab-ci.yml)
security-scan:
stage: test
image: node:18
script:
- curl -O https://raw.githubusercontent.com/nxgn-kd01/cve-2025-55182-scanner/main/scan.js
- chmod +x scan.js
- node scan.js --ci
allow_failure: false
该扫描器执行以下检查:
package.json 文件dependencies 和 devDependencies'use server' 指令'use server' 指令(表明正在使用服务端函数)该扫描器包含智能检测以防止误报:
output: 'export' 的项目会被标记为可能安全'use server' 指令以确认实际使用了服务端组件示例输出:
✓ No vulnerable projects found
ℹ Projects with analysis notes:
1. /path/to/project
ℹ Next.js ^15.1.3 is in vulnerable range, but using React 18 (safe - only React 19 affected)
2. /path/to/another-project
ℹ Next.js 16.0.5 with React 19 detected, but no 'use server' directives found (likely safe).
Note: dynamically imported Server Functions require manual review.
node scan.js -r
对于每个易受攻击的项目,运行建议的修复命令:
cd /path/to/project
npm install [email protected] [email protected] # Example
或使用 yarn:
yarn upgrade [email protected] [email protected]
或使用 pnpm:
pnpm update [email protected] [email protected]
npm test
npm run build
node scan.js --ci
答:目前,扫描器检查的是 package.json 中的直接依赖。如需深入的依赖扫描,请将此工具与 npm audit 或 yarn audit 结合使用。
答:不会,React 18 不受影响 ✅
CVE-2025-55182 仅影响 React 19.x 的服务端组件。即使使用了处于易受攻击版本范围内的 Next.js 15.x 或 16.x 版本,扫描器也会正确地将 React 18 应用识别为安全。
答:可以! 使用 --ci 标志,扫描器在发现漏洞时会以退出码 1 退出,从而使管道构建失败。请参阅上面的 CI/CD 集成示例。
答:临时缓解措施(升级是唯一彻底的修复方法):
⚠️ 重要提示: 这些只是临时措施。请尽快升级到已修补的版本。
答:非常准确,具备智能防误报能力:
'use server' 指令以确认实际漏洞答:扫描器会检测源文件中的 'use server' 指令。但是,动态导入的服务端函数(通过 import() 在运行时加载)可能无法被静态检测到。如果扫描器报告"未找到 'use server' 指令",但你对服务端函数使用了动态导入,则应手动审查这些文件。扫描器会附带一条备注提醒你这一点。
欢迎贡献!请随时提交 issue 或拉取请求(pull request)。
# Test on sample projects
./test-scanner.sh
该扫描器现可根据 React 官方公告检测所有支持 RSC 的主要框架:
如需支持其他框架,请提交 issue 或提交 PR。
MIT 许可证 - 详情请参阅 LICENSE 文件
本工具按"原样"提供给社区,用于帮助识别易受攻击的项目。在部署到生产环境之前,请始终验证扫描结果,并在安全环境中测试更新。
如果你觉得此工具有用,请:
保持安全,并及时更新你的依赖!
| 属性 | 值 |
|---|
| CVE ID | CVE-2025-55182 |
| 名称 | React2Shell |
| CVSS 评分 | 10.0(严重) |
| CVSS 向量 | AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H |
| 攻击向量 | 网络 |
| 身份验证 | 无需 |
| 影响 | 系统完全失陷 |
15.5.616.0.0 至 16.0.9| 选项 | 描述 |
|---|
-r, --recursive | 扫描所有子目录中的 Node.js 项目 |
-v, --verbose | 显示详细输出 |
--json | 以 JSON 格式输出结果 |
--ci | 若发现漏洞则以退出码 1 退出(用于 CI/CD) |
-h, --help | 显示帮助信息 |