Skip to content
Prototype pollution Write-up Advanced

React2Shell — CVE-2025–55182: Practical Exploitation of the Vulnerability

A deliberately vulnerable Next.js training app exposes a Server Action that deserialises React Server Component Flight data without validating its structure, allowing prototype pollution and constructor chaining. An attacker could send a crafted multipart request to reach arbitrary JavaScript execution on the server.

snehbavarva Follow

Published on snehbavarva.medium.com

In a previous post, we explored React2Shell as a concept and how insecure deserialization in React Server Components (RSC) can lead to prototype pollution and in RCE.

Sneh Bavarva, on snehbavarva.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

Likely the Server Action deserialises untrusted Flight data without schema validation, so prototype pollution and constructor chaining reach the Function constructor.

Impact

An attacker could execute arbitrary JavaScript in the server context, and because Server Actions are exposed as HTTP endpoints by default, no UI access is needed.

What the attacker needed

Network access to the app; vulnerable React/Next.js version; no account needed

The fix

React and Next.js should be upgraded to the patched version, and Server Action inputs should be validated with schemas.

How it was found

  1. Open the training app and locate the Server Action that handles fund transfers.
  2. Send a crafted multipart/form-data request that mimics a valid RSC Flight payload to the exposed POST endpoint.
  3. Point the request at the training probe route to test whether the payload is accepted.
  4. Use prototype pollution, constructor chaining and deserialisation side-effects to reach code execution.

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 called Flight, and the server rebuilds that data when it arrives. If the server trusts the shape of that data, an attacker can slip in special property names that change built-in JavaScript objects (prototype pollution) and eventually run their own code on the server. This demo app was built on purpose to show that mistake.

What is Prototype pollution?

Input changes JavaScript's shared object prototype, altering behaviour across the application, sometimes to XSS or code execution.

More by snehbavarva

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Prototype pollution

The lesson behind this report.

Input changes JavaScript's shared object prototype, altering behaviour across the application, sometimes to XSS or code execution.