Answers · Next.js

React2Keys: an unpatched Next.js server is leaking its env vars. How to check yours and what to rotate

React2Shell (CVE-2025-55182) is a year old: React and Next.js fixed it on Dec 3, 2025. CloudSEK's report of Nov 30, 2026 says someone is still running it at scale against servers that never upgraded. The campaign, which CloudSEK calls React2Keys, sends one unauthenticated POST to a Next.js server, runs code inside the Node process, and takes every env var that looks like a key, plus .env* files, cloud credential files and SSH keys. CloudSEK counts 50,000+ credentials from 19,000+ victims, across 400+ organizations.

If you run a Next.js App Router app on 15.x or 16.x below the fixed versions, assume its secrets are gone. Patching closes the hole but revokes nothing: upgrade, redeploy, then rotate every secret the server could read. If it runs on a machine you can SSH into, also look for the attacker's SSH key, because patching doesn't remove that either.

Are you affected?

Per the Next.js advisory, the RCE affects apps using the App Router on Next.js 15.x and 16.x, and 14.3.0-canary.77 and later canaries. Next.js 13.x, 14.x stable, Pages Router apps and the Edge Runtime are not affected. The fix landed in these releases:

  • 15.0.5, 15.1.9, 15.2.6, 15.3.6, 15.4.8, 15.5.7 and 16.0.7 (and 15.6.0-canary.58 / 16.1.0-canary.12). Lines released later, 16.1 onward, shipped with it.
  • Other React Server Components setups are affected too: react-router, waku, @parcel/rsc, @vitejs/plugin-rsc and rwsdk, through react-server-dom-webpack, -parcel or -turbopack 19.0.0, 19.1.0, 19.1.1 or 19.2.0 (fixed in 19.0.1, 19.1.2 and 19.2.1).

Your checks, in order

  1. Find the version that's actually running. Check what the server runs, not only package.json: an old image or server can keep running after the repo was updated. Run this in the app folder on the server (or in the container, or in .next/standalone), or pass a version as an argument:

    node -e '
    const v = process.argv[1] || require("next/package.json").version;
    const [M, m, p] = v.split(/[.-]/).map(Number);
    const fix = { "15.0": 5, "15.1": 9, "15.2": 6, "15.3": 6, "15.4": 8, "15.5": 7, "16.0": 7 };
    const k = M + "." + m;
    console.log("next " + v + ": " + (
      v.includes("canary") ? "canary build, check the advisory table" :
      M < 15 ? "not affected by the RCE (13.x and 14.x stable)" :
      !(k in fix) ? "line released with the fix" :
      p >= fix[k] ? "has the RCE fix" : "VULNERABLE to CVE-2025-55182"));' $VERSION

    Leave $VERSION empty to read the installed next. In a monorepo, npm ls next lists every copy.

  2. Upgrade to the newest patch in your line, not just the RCE fix. Later advisories (a denial of service and a source-code exposure in Dec 2025, another denial of service in Jan 2026) raised the floors again. npm install [email protected] installs the newest 15.5.x (15.5.29 today); use your own line. The Next.js team also publishes an interactive updater, npx fix-react2shell-next. Then rebuild and redeploy, and confirm the check above on the live server.

  3. Rotate everything the server could read. The Next.js advisory says that if your app was online and unpatched as of Dec 4, 2025, 1:00 PM PT, you should rotate every secret it uses, most critical first. CloudSEK says the payload reads every env var that looks like a credential, .env* files (including oddly named .env.* ones), cloud credential files, SSH keys and the Kubernetes service-account token. In practice:

    • AI provider keys (Anthropic, OpenAI, Gemini, OpenRouter, Azure AI). Stolen keys are tested against roughly ten providers, and keys with no credit left are kept, not thrown away.
    • Database URLs and passwords. CloudSEK saw live Postgres, Redis and MongoDB sessions opened to victims' own databases.
    • Cloud keys, plus any role the server can assume. On AWS, the payload asks the container metadata endpoint and EKS Pod Identity for temporary credentials even when no static key exists. On Azure it takes managed-identity tokens.
    • GitHub tokens. One was used to run code search across a victim's whole organization for more keys, so also scan your repos (gitleaks git -v .).
    • The credential for your secrets manager, if the app has one. In one case it was used to pull every secret in the vault.
    • Payment, domain registrar, email (SMTP), messaging and Telegram bot tokens. If Claude Code was signed in on that server, treat the login as stolen: CloudSEK saw victims' Claude Code tokens refreshed and used.

    Create the new secret, deploy it, then revoke the old one. For Stripe, see rotating a leaked Stripe secret key without breaking webhooks.

  4. Look for the attacker's SSH key on any VPS or VM that ran the app. CloudSEK says the actor appends its own public key to authorized_keys, so access survives the patch. This searches for the key published in CloudSEK's report (it prints nothing if the key isn't there):

    sudo grep -rlF 'AAAAC3NzaC1lZDI1NTE5AAAAINiNfAw552VRo+E3mBu/MHaVsRDcN0BMGuVCjgIyHbb3' \
      /root/.ssh /home/*/.ssh 2>/dev/null

    Then read every authorized_keys file and remove any key you don't recognise, look at cron (sudo crontab -l, crontab -l for the app's user, /etc/cron.d), and review recent SSH logins (last -i, or journalctl -u ssh / -u sshd). If you find the key, rebuild the machine from a clean image instead of cleaning it by hand.

  5. Check usage and audit logs for calls you didn't make: AI-provider usage pages, AWS CloudTrail (new IAM users, Bedrock model-access changes, instances you didn't start), and your cloud's audit log. CloudSEK says that on AWS accounts where Bedrock sits behind its use-case form, the actor's script fills in the form with the stolen credentials. If a leaked AI key ran up charges, see getting OpenAI or Anthropic charges refunded.

How it finds servers

  • It polls six public Certificate Transparency logs every three minutes, so a new HTTPS certificate can become a target within minutes of a deploy. About 3% of the domains it fingerprints turn out to be Next.js.
  • When Cloudflare blocks the payload at the edge, a separate module tries to find the origin server and hit it directly. A WAF in front doesn't help if your origin also answers on its public IP.
  • The exploit follows redirects and re-sends the body at each hop, so an app behind an auth-middleware redirect isn't mistaken for patched.
  • Runtimes seen: Kubernetes pods, AWS Lambda, ECS Fargate, PM2 hosts and generic containers.

What isn't known or we didn't verify

  • Every count (50,000+ credentials, 19,000+ victims, 400+ organizations) is CloudSEK's, from material it says it recovered from the attacker's servers. We didn't check them, and the report doesn't say how the 19,000 victims and the 400 organizations relate.
  • When the campaign started. The report has no start date we could read, and its detection rule is dated Nov 24, 2026.
  • Whether apps on managed platforms such as Vercel or Netlify were among the victims. The report doesn't say. React says hosting providers added temporary mitigations in Dec 2025 and that you shouldn't depend on them.
  • Whether your server was hit. CloudSEK offers an exposure lookup at exposure.cloudsek.com/react2keys that asks for your domain or work email. We didn't use it.
  • Whether the attacker key's comment (bluelocale-foothold in the attacker's script, per CloudSEK) is always present. Match on the key itself, as above.

Checked against CloudSEK TRIAD: React2Keys (Nov 30, 2026), Next.js: Security Advisory CVE-2025-66478 (Dec 3, 2025, updated Dec 6), Next.js: Security Update, December 11, 2025, React: Critical Security Vulnerability in React Server Components (Dec 3, 2025), GitHub advisory GHSA-9qr9-h5gf-34mp (next), GitHub advisory GHSA-fv66-9v8q-g76r (CVE-2025-55182), gitleaks on 2026-12-02. Only test apps and accounts you own or are allowed to test.