published: · updated:
CVE-2025-55182: A React Vulnerability Nightmare
After receiving a Vercel security email about a critical React Server Components vulnerability, I updated the affected packages and investigated CVE-2025-55182 and CVE-2025-66478.
Written by: gymynnym
CVE-2025-55182: A React Vulnerability Nightmare
Introduction

Translation: A critical vulnerability in React Server Components (CVE-2025-55182) has been responsibly disclosed. It affects React 19 and frameworks that use it, including Next.js (CVE-2025-66478).
This morning, I received the email above from Vercel. Since LogHub’s web project uses Next.js, I immediately checked the repository’s Security tab. Dependabot had already opened an alert for CVE-2025-66478, rated Critical (10/10)!

I quickly upgraded react, react-dom, and next to patched versions, then began investigating the vulnerability in detail.
Investigating the Vulnerability
This article draws on Security Advisory: CVE-2025-66478.
CVE-2025-66478
CVE-2025-66478 is a critical vulnerability with the maximum CVSS score of 10. It allows attackers to use the RSC (React Server Components) protocol for RCE (remote code execution).
CVE-2025-66478 derives from CVE-2025-55182. The distinction is:
CVE-2025-66478: vulnerability in the next package.CVE-2025-55182: vulnerability in the RSC (React Server Components) protocol.- Affected packages:
react-server-dom-webpack: < 19.2.0,react-server-dom-turbopack: < 19.2.0.
- Affected packages:
CVE-2025-55182
Vulnerability Analysis
Related PR: facebook/react/pull/35277.
The root cause of CVE-2025-55182 in React is the requireModule function. This helper uses the bundler’s runtime require function (parcelRequire) to load a module from the registry and return a specific export.
// Vulnerable implementation
export function requireModule<T>(metadata: ClientReference<T>): T {
const moduleExports = parcelRequire(metadata[ID]);
return moduleExports[metadata[NAME]];
}
The original implementation accessed moduleExports[metadata[NAME]] without validating metadata[NAME]. Manipulated metadata could therefore access unintended properties. The following change prevents this.
// Patched implementation
export function requireModule<T>(metadata: ClientReference<T>): T {
const moduleExports = parcelRequire(metadata[ID]);
if (hasOwnProperty.call(moduleExports, metadata[NAME])) {
return moduleExports[metadata[NAME]];
}
return (undefined: any);
}
The patched implementation uses hasOwnProperty.call to verify that moduleExports directly owns the metadata[NAME] property. Otherwise, it returns undefined to prevent arbitrary property access.
Reproducing the Attack
Based on ejpir/CVE-2025-55182-poc.
$ git clone git@github.com:ejpir/CVE-2025-55182-poc.git
$ cd CVE-2025-55182-poc
$ npm install
$ npm run start
$ npm run exploit # RCE attack (arbitrary code execution via vm#runInThisContext)
The commands above start a vulnerable server and attempt remote code execution. Beyond the cases provided by the exploit script, the following RCE gadgets are available:
| Gadget | Description |
|---|---|
vm#runInThisContext |
Execute arbitrary JavaScript in the current context |
vm#runInNewContext |
Execute arbitrary JavaScript in a new context (sandbox) |
child_process#execSync |
Execute shell commands |
child_process#execFileSync |
Execute a binary file |
child_process#spawnSync |
Create a new process (returns an object) |
fs#readFileSync |
Read arbitrary files |
fs#writeFileSync |
Write arbitrary files |
Terrifying…
Closing Thoughts
CVE-2025-66478 and CVE-2025-55182 shook the React ecosystem and demonstrated how vulnerabilities in shared libraries and frameworks can seriously threaten many web applications.
Bonus: Cloudflare’s Response
Cloudflare WAF proactively protects against React vulnerability
Cloudflare quickly deployed rules blocking this vulnerability to all WAF (Web Application Firewall) users. Cloudflare is a lifesaver…