Skip to content
RCE Write-up Advanced

CVE-2025–5182: The Perfect 10.0 React Vulnerability That Broke

React Server Components deserialised data by checking only whether an object had a callable 'then' property, so a crafted object could run arbitrary JavaScript on the server. An unauthenticated attacker could then execute OS commands, read and write files, and steal secrets.

bharath Follow

Published on medium.com

On a seemingly normal day in the React ecosystem, a critical vulnerability emerged that sent shockwaves through the development community. CVE-2025–5182 earned the rare and dreaded CVSS score of 10.0 — the highest possible severity rating.

Bharath, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The deserialiser used duck typing (checking only for a callable 'then' property) instead of verifying the object was a genuine Promise, so attacker-controlled 'then' code was invoked during deserialisation.

Impact

An unauthenticated attacker could execute arbitrary JavaScript and OS commands on the server, read and write files, steal environment secrets, pivot to internal systems and install backdoors.

What the attacker needed

Vulnerable React Server Components version; network access to the app; no authentication needed

The fix

The fix replaced the duck-typing check with an instanceof Promise check or an own-property check on 'then'; the text says a 712-line patch was released.

How it was found

  1. Create a fresh Next.js app with the vulnerable React Server Components version and start it locally.
  2. From the browser developer console, send a payload that logs a string on the server.
  3. Send a payload that lists the server's files.
  4. Send a payload that creates a file on the server.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

React Server Components let a server send data to the browser in a special format. The server checked only whether an incoming object had a 'then' function, which is how JavaScript recognises something that behaves like a Promise (a placeholder for a future result). A malicious object could supply its own 'then' function, and when the server called it, the attacker's code ran on the server.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by bharath

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.