1. Overview of vulnerabilities
Vulnerability Number: CVE-2025-55182
Vulnerability Type:: Remote Code Execution (RCE)
vulnerability level:: Critical
Sphere of influence: Next.js, React Server Components related frameworks and libraries
Discovery Time:: 2025
restoration status:: Patches released
CVE-2025-55182 is a critical remote code execution vulnerability affecting the Next.js framework and its dependent libraries. The vulnerability stems from insufficient checksums in the Next.js App Router's handling of React Server Components (RSC) serialized data, which allows an attacker to achieve arbitrary code execution on the server side by constructing a malicious RSC request.
2. Description of the vulnerability
2.1 Technical background
Next.js is an open source web framework based on React , widely used to build server-side rendering (SSR), static site generation (SSG) and hybrid rendering applications.React Server Components (RSC) is a feature introduced in React 19 that allows developers to execute component logic directly on the server and send serialized component state to the client.
2.2 Vulnerability Trigger Conditions
The vulnerability is triggered in Next.js by the following condition.
-
Next.js version uses React 19 (integration starts as early as May 2024)
-
The application uses the App Router routing method
-
Failure to perform adequate security checks on RSC serialized data from clients
2.3 Specific manifestations
Core issues of vulnerabilityIn.
-
Next.js directly hands over the RSC serialized data sent by the client to ReactFlightReplyServer for deserialization
-
Lack of adequate validation of model structure, reference paths and Server Reference metadata
-
Multiple key functions in the RSC parsing link (parseModelString, getOutlinedModel, loadServerReference, initializeModelChunk, etc.) fail to effectively validate data legitimacy
-
An attacker can control the call target during the module loading and reference binding phase with a carefully constructed malicious RSC request.
3. Principles and causes of vulnerabilities
3.1 RSC deserializationworkflows
The communication mechanism for React Server Components involves the following key steps.
-
serialization stage: The server component executes on the server side and its state is serialized into a specific format to be sent to the client
-
transmission stage: Serialized data is transferred to the client over the network
-
deserialization stage: Client receives data and deserializes it into React component state
3.2 Vulnerability Causes Analysis
The causes of this vulnerability include the following.
Lack of structural calibration: The model structure of RSC serialized data is not sufficiently validated, allowing attackers to inject unintended data structures
Citation path control flawsThe loadServerReference function does not perform strict security checks on the reference path when loading a Server Reference, allowing an attacker to point to any module that can be loaded.
Metadata not adequately validated: Server Reference metadata contains information such as module IDs, export names, etc. Insufficient checksums on this metadata allow attackers to point to insecure functions
Deserializer trust issues: ReactFlightReplyServer puts too much trust in the operations performed on deserialized objects, directly calling functions such as parseModelString, getOutlinedModel, etc. to process user inputs
3.3 Attack chain analysis
The attacker's exploit link is as follows.
Malicious RSC requests
↓
parseModelString (data format parsing)
↓
getOutlinedModel (model get)
↓
loadServerReference (load server reference)
↓
initializeModelChunk
↓
Control function call target
↓
Arbitrary code execution
In the above link, an attacker can inject malicious data at multiple points, resulting in.
-
Loading unintended modules
-
Calling unintended functions
-
Passing malicious parameters
-
Eventually execute arbitrary code on the server side
4. Vulnerability impacts and hazards
4.1 Direct impacts
remote code execution:: Attackers can execute arbitrary code on the server side without authentication, with the highest level of compromise
The servers are completely down.: An attacker gaining the same privileges as the Node.js process can.
-
Access to sensitive data stored by the application (database credentials, API keys, user data, etc.)
-
Modify or delete data on the server
-
Installation of backdoor programs for persistent control
-
Used to launch further intranet attacks
data breach:: Attackers can access and steal all sensitive information stored on the server
4.2 Affected user groups
The vulnerability affects the following people.
-
All production applications using the affected version of Next.js
-
Projects that use the associated React Server Components library(react-server-dom-webpack, react-server-dom-turbopack, react-server-dom-parcel)
-
Users of web applications built on Next.js
-
Users of low-code platforms such as Dify
4.3 Physical threat assessment
The vulnerability has the following characteristics resulting in a higher actual threat.
-
Easy to use: Attackers simply send carefully constructed HTTP requests
-
No authentication required: Exploit does not require a valid user identity
-
wide ranging influence: Next.js and React are the dominant frameworks in web development with a wide range of influences
-
High degree of automation:: Automated tools can be developed for bulk scanning and utilization
5. Vulnerable POC/EXP
5.1 Examples of Exploit Principles
The following code demonstrates a possible exploit idea for an attacker (for educational purposes only).
// Construct malicious RSC serialization requests
// RSC format example: D{serialized data}T{server-side reference}
// Malicious payload structure that an attacker can construct.
const maliciousRSCPayload = {
// By controlling model structure and reference paths
model: {
// Point to an unsafe module
$$ype:"@@MODULE_REFERENCE",
id: "... /... /server/sensitive-module",
name: "dangerousFunction"
},
// Pass malicious parameters
args: [
"require('child_process').execSync('malicious-command')"
]
};
// Send a malicious request to the App Router interface
fetch('/api/rsc', {
method: 'POST',
body: serializeRSC(maliciousRSCPayload)
});
5.2 Critical Attack Vector
Vector 1 - Module path traversal:
By constructing path traversal characters (e.g. ... /... /...) to load modules that are not in the expected range.
Vector 2 - Server Reference Fake:
Fake Server Reference metadata so that loadServerReference loads and executes arbitrary functions.
Vector 3 - Parameter Injection:
Injecting malicious parameters into serialized data, which is deserialized and then used directly in function calls.
5.3 Detection methods
The vulnerability can be tested for exploitation by.
# Checking the Next.js version
npm list next
# Check the application logs for abnormal RSC requests
# Concerns POST requests whose request body contains the following characteristics.
# - MODULE_REFERENCE pointing to system module
# - Contains path traversal symbols (... /... /)
# - Unusual Server Reference metadata
# Monitor process execution and check for abnormal sub-process startups
6. Rehabilitation proposals or programs
6.1 Official fixes
Next.js has officially eliminated the vulnerability by upgrading the React Server Components related dependencies and binding to the fixed RSC parsing portal. Key improvements of the fix include.
Enhanced data validation: Strict checksumming of the structure of RSC data prior to deserialization
Secure module loading: The loadServerReference function implements a whitelisting mechanism that allows only the expected modules to be loaded.
Metadata security check: Server Reference metadata is verified by a signature or other security mechanism.
Error handling improvements: Abnormal data is safely rejected rather than attempted to be processed
6.2 Emergency repair steps
Step 1 - Upgrade Dependencies Now:
# Upgrade Next.js to a Fixed Version
npm update next@latest
# Synchronized update of React Server Components related libraries
npm update react-server-dom-webpack
npm update react-server-dom-turbopack
npm update react-server-dom-parcel
# Upgrade to 1.10.1-fix.1 or later if using Dify
npm update dify
Step 2 - Full Version Correspondence Table:
For different Next.js version branches, upgrade to the following minimum fixes.
| Affected version range | restoration version | prioritization |
|---|---|---|
| 15.1.1-canary.0 ~ 15.1.9 | 15.1.9 | your (honorific) |
| 14.3.0-canary.77 ~ 15.0.5 | 15.0.5 | your (honorific) |
| 15.5.1-canary.0 ~ 15.5.7 | 15.5.7 | your (honorific) |
| 15.2.0-canary.0 ~ 15.2.6 | 15.2.6 | your (honorific) |
| 15.3.0-canary.0 ~ 15.3.6 | 15.3.6 | your (honorific) |
| 15.4.0-canary.0 ~ 15.4.8 | 15.4.8 | your (honorific) |
| 16.0.0-canary.0 ~ 16.0.7 | 16.0.7 | your (honorific) |
React Server Components library fix release:
| library name | Affected versions | restoration version |
|---|---|---|
| react-server-dom-webpack | 19.0 ~ 19.0.1 | 19.0.1 |
| 19.1.0 ~ 19.1.2 | 19.1.2 | |
| 19.2.0 ~ 19.2.1 | 19.2.1 | |
| react-server-dom-turbopack | 19.0 ~ 19.0.1 | 19.0.1 |
| 19.1.0 ~ 19.1.2 | 19.1.2 | |
| 19.2.0 ~ 19.2.1 | 19.2.1 | |
| react-server-dom-parcel | 19.0 ~ 19.0.1 | 19.0.1 |
| 19.1.0 ~ 19.1.2 | 19.1.2 | |
| 19.2.0 ~ 19.2.1 | 19.2.1 | |
| dify | 0 ~ 1.10.1 | 1.10.1-fix.1 |
Step 3 - Verify the upgrade:
# Flush Dependency Cache
rm -rf node_modules package-lock.json
# Reinstall dependencies
npm install
# Validated Version
npm list next react-server-dom-webpack
# Restart application
npm run build
npm start
6.3 Long-term defense strategies
Code Audit:
-
Review RSC-related code in App Router
-
Check for custom deserialization logic
-
Ensure there are no additional safety hazards
access control:
-
Restrict access to API endpoints (if possible)
-
Implementation of IP-based access control
-
Deploy WAF rules to detect anomalous RSC requests
Monitoring and Logging:
-
Enable detailed application logging
-
Monitor for unusual HTTP request patterns
-
Setting Alert Rules to Detect RCE Attempts
Dependency management:
-
Regularly update dependency packages
-
Checking for security vulnerabilities with npm audit
-
Consider using software composition analysis (SCA) tools
Security Best Practices:
-
Restrict Node.js process privileges by following the least privilege principle
-
Running applications in a container or sandbox environment
-
Regular security testing and penetration testing
6.4 Interim mitigation measures (before upgrading)
If for some reason an immediate upgrade is not possible, the following interim measures can be taken to reduce the risk.
// Add RSC request validation to the middleware
export function middleware(request) {
// Detect suspicious RSC requests
if (request.nextUrl.pathname.includes('/rsc') ||
request.headers.get('rsc') === 'true') {
// Check for suspicious patterns in the request body
const body = request.body;
// Reject requests containing path traversal or exception references
if (body.includes('... /... /') ||
body.includes('MODULE_REFERENCE') ||
body.includes('eval')) {
return new Response('Forbidden', { status: 403 });
}
}
return NextResponse.next();
}
Important Notes:: Interim measures only reduce the risk and do not completely eliminate the vulnerability threat. You should upgrade to the official fix as soon as possible.
7. Reference citations
referenced resource:
-
Next.js GitHub Repository - Security Advisory. https://github.com/vercel/next.js/security/advisories
-
React Server Components Documentation. https://react.dev/reference/rsc/server-components
-
CVE-2025-55182 Official Details. https://nvd.nist.gov/vuln/detail/CVE-2025-55182
Related items:
-
Next.js Official Website. https://nextjs.org/
-
React Official Documentation. https://react.dev/
-
Dify GitHub Repository & Release Notes. https://github.com/langgenius/dify/releases/tag/1.10.1-fix.1
Security reference:
-
OWASP Code Injection. https://owasp.org/www-community/attacks/Code_Injection
-
CWE-94: Improper Control of Generation of Code ('Code Injection') https://cwe.mitre.org/data/definitions/94.html
-
Node.js Security Best Practices. https://nodejs.org/en/docs/guides/security/
Original article by Chief Security Officer, if reproduced, please credit https://www.cncso.com/en/cve-2025-55182-react-server-components-rce.html
