
Proof-of-concept exploit demo for CVE-2025-66478 using Node.js
This repository contains proof-of-concept (PoC) code for reproducing and researching the Next.js CVE-2025-66478 vulnerability. It includes a vulnerable Next.js application and a Node.js exploit script for testing the vulnerability.
English · 中文
This is a Remote Code Execution (RCE) vulnerability that occurs during Next.js Server Actions processing.
Key Points:
__proto__ property.| Item | Description |
|---|---|
| CVE ID | CVE-2025-66478 |
| Type | Remote Code Execution (RCE) |
| Root Cause | Insecure deserialization in RSC Flight protocol |
| Severity (CVSS) | 10.0 (Critical) |
| Impact | Arbitrary system command execution on the server |
__proto__.Object.prototype being polluted.then property into all objects. Next.js logic incorrectly identifies these objects as Promises (Thenables).await this "fake Promise", the malicious JavaScript code injected into the then method is executed (e.g., child_process.execSync).sequenceDiagram
participant Attacker as Attacker
participant Server as Next.js Server
Attacker->>Server: POST / (JSON with "__proto__": {"then": ...})
Note right of Server: JSON parsing pollutes Object.prototype
Server->>Server: Application logic encounters an object
rect rgb(200, 150, 150)
Note right of Server: "Thenable" check exploitation chain
Server->>Server: Check: typeof obj.then === 'function'?
Server-->>Server: Yes (due to pollution)
end
Server->>Server: Await/execute malicious .then()
Note right of Server: Malicious JS code runs (RCE)
Server-->>Attacker: Response (Action redirect / Error message)Therefore, when the server processes this manipulated Promise, it executes the JavaScript code injected by the attacker, which can lead to system command execution. The included main.mjs is example code for reproducing this attack scenario.
This vulnerability affects Next.js applications using the App Router.
Patched Versions:
app/page.tsx: Sample code for the vulnerable application.exploit.mjs: Exploit execution script written in Node.js.# You can also use yarn or npm.
pnpm install
pnpm dev
Verify that you can access http://localhost:3000 via your browser.
pnpm exploit
By default, it targets the local address (http://localhost:3000). To test a different address, use the --url option:
pnpm exploit --url http://target-ip:3000
This code is intended for security research and educational purposes only. Using this tool against systems or networks without prior permission is illegal, and users bear full responsibility for any issues arising from such use.