⚛️
Security

RCE vulnerability in Next.js and React: how to check your project

25.11.2026
← All articles

Remote code execution (RCE) is the worst class of web application bug: one crafted HTTP request, no password or account needed, and the attacker runs commands on your server. In late 2025 such a flaw was disclosed in React Server Components, and it affected Next.js versions that use the App Router. Below is how to tell whether your project is exposed, how to update properly, and what to check if the server may already be compromised.

Where the flaw is and why it matters

Server Components exchange data between browser and server in a special format. The bug was in the server code that deserializes that data: a crafted request could make the server build an unexpected object and ultimately execute arbitrary code. Your app did not need any custom server actions, because the vulnerable code lived in the framework itself. React shipped fixed releases of its React 19 server component packages, and Next.js released fixes for its 15 and 16 lines. Automated scanners appeared quickly, and typical outcomes were cryptominers, backdoors and stolen .env secrets.

Check what is actually installed

package.json may only contain a range like ^15.1.0, so check the real installed versions:

npm ls next react react-dom react-server-dom-webpack
npm audit
pnpm why next   # or: yarn why next

Projects on Next.js 15 or 16 using the App Router (app/ directory) are the main risk group. Confirm the exact patched version for your minor line in the official Next.js and React security advisories, since each line got its own fixed release. Older 13 and 14 projects are not automatically safe either, especially once they are out of support.

Update and rebuild

The classic mistake is editing package.json while the server keeps running the old build in .next. Rebuild and restart, or rebuild the Docker image:

npm install next@15 react@19 react-dom@19
npm run build
pm2 restart myapp

docker compose build --no-cache
docker compose up -d

Move to the latest patched release of your current line first and plan major upgrades separately. Run npm ls next again afterwards, since monorepos or multiple lock files can hide a second, still vulnerable copy. Test the application after the update before you consider the incident closed.

Look for signs of compromise

If the app was internet-facing on a vulnerable version, the attacker may have left another way in before you patched. Check the app user's processes, cron jobs and temp folders:

ps -u appuser -o pid,ppid,%cpu,cmd --sort=-%cpu
crontab -l -u appuser
find /tmp /var/tmp /dev/shm -type f -newer package.json -ls
pm2 logs myapp --lines 200

A process whose parent is node but which is itself sh, curl, wget or an unknown binary is a strong red flag, as are constant high CPU, connections to unknown hosts and keys in ~/.ssh/authorized_keys you did not add.

Rotate your secrets

If you find traces, or the app ran exposed for a long time, assume everything in .env leaked: database password, payment keys, SMS and mail tokens, JWT signing key and third-party API keys. Issue new ones and revoke the old. An online course platform in Samarkand running Next.js 15 under pm2 delayed its update for weeks; investigators found a miner spawned by node and a cron entry under the app user, and besides cleaning and rebuilding they rotated the database password, payment keys and JWT key.

Be ready for the next one

Enable automated dependency checks, follow the Next.js and React advisories and commit your lock file. Run the app as a dedicated unprivileged user rather than root, and put Nginx in front instead of exposing the Node.js port directly. On a sayt.uz VPS you have full control and run these steps yourself; for questions about load or network activity, open a ticket from your cabinet.

Related articles

🗝️ Passkeys: How Passwordless Sign-In Actually Works 🛡️ Disabling PHP in the Upload Folder: Apache and Nginx Rules 🗂️ 644 and 755: Correct File Permissions for Websites 🐚 What is a webshell and how to find one on your server
🌐 Language
🇺🇿 O⁠'zbek 🇺🇿 Özbek (yangi) 🇺🇿 Ўзбек 🇷🇺 Русский 🇬🇧 English ✓