React2Keys: What a Year-Old Next.js Bug Teaches Us About AI API Key Security

On this page11 sections
React2Shell was patched in December 2025. In November 2026, an automated campaign used it to walk out with more than 50,000 secrets.
That is the core of React2Keys, a campaign disclosed on November 30, 2026 in CloudSEK's React2Keys credential theft report. CloudSEK says an attacker exploited React2Shell (CVE-2025-55182), a critical remote code execution flaw in React Server Components that affects Next.js App Router apps, on unpatched servers between November 9 and 19, 2026. The attacker dumped environment variables and secret files and stole AI API keys for Anthropic, OpenAI and Gemini, along with AWS, Azure and GCP identities, database passwords and Claude Code login tokens. It then validated the keys and used some of them on the victims' own bills.
If you ship Next.js, the first lesson is about patch hygiene. If you ship anything that holds an LLM key, the bigger lesson is about what your server process can read once someone is inside it.
What happened in the React2Keys campaign?
React2Shell in one paragraph
React Server Components (RSC) let a React app run code on the server. Server Functions, which Next.js calls Server Actions, let the browser call server-side functions over HTTP using React's "Flight" serialization format. On November 29, 2025, researcher Lachlan Davidson reported that React decoded those payloads unsafely. An unauthenticated attacker could send one crafted HTTP request and get code execution on the server.
React disclosed the flaw on December 3, 2025 in its official CVE-2025-55182 security advisory, with a CVSS score of 10.0. The affected packages were react-server-dom-webpack, react-server-dom-parcel and react-server-dom-turbopack, versions 19.0.0, 19.1.0, 19.1.1 and 19.2.0. The first fixes shipped in 19.0.1, 19.1.2 and 19.2.1.
React's advisory makes a point many teams missed: an app can be vulnerable even if it never defines a Server Function, as long as it supports React Server Components.
Next.js first tracked its exposure in a separate Next.js CVE-2025-66478 advisory. That ID was later rejected as a duplicate, and CVE-2025-55182 is the canonical identifier. The NVD entry for CVE-2025-55182 has the official record.
Exploitation started quickly. The AWS Security Blog report on China-nexus React2Shell exploitation says Amazon saw exploitation attempts within hours of disclosure. CISA added the CVE to its Known Exploited Vulnerabilities catalog on December 5, 2025.
The React2Keys timeline
| Date | Event | Source |
|---|---|---|
| Nov 29, 2025 | React2Shell reported to Meta Bug Bounty | React advisory |
| Dec 3, 2025 | CVE-2025-55182 disclosed, first fixes published | React, Next.js |
| Dec 5, 2025 | Added to CISA KEV | CISA (via Rapid7 and others) |
| Dec 11, 2025 | Follow-up DoS and source-exposure CVEs disclosed | React, Next.js |
| Jan 26, 2026 | Additional DoS CVE-2026-23864, new fix versions | React, Vercel |
| Apr 2, 2026 | Talos reports UAT-10608: 766 hosts in 24 hours | Cisco Talos |
| Nov 9, 2026 | React2Keys scanning and env dumping begins | CloudSEK, via SecurityWeek |
| Nov 9-18, 2026 | Mass exploitation | CloudSEK, via SecurityWeek |
| Nov 19, 2026 | Last observed exfiltration | CloudSEK, via SecurityWeek |
| Nov 30, 2026 | CloudSEK publishes React2Keys report | CloudSEK |
How big was it? (all figures per CloudSEK)
- 50,000+ credentials across AI, cloud, database, payment, domain registrar and crypto categories
- 19,000+ victims, which news coverage such as SecurityWeek's React2Keys report describes as hosts
- Infrastructure linked to 400+ organizations
- 225 captured AWS temporary-credential files, which CloudSEK says show the keys were being validated almost as soon as they were stolen
CloudSEK says it based these numbers on the attacker's own logs and infrastructure. No other research team has published independent confirmation yet, so treat them as vendor-reported findings.
From one HTTP request to your secrets
CloudSEK's write-up describes a methodical pipeline:
- Discovery. The attacker watched public Certificate Transparency logs for new TLS certificates, so a fresh deployment could become a target within minutes.
- Initial access. One unauthenticated POST request with a crafted React Flight payload ran attacker JavaScript inside the Node.js process. The output came back inside Next.js's own error responses.
- Harvesting. The payload read every environment variable,
.env*files, cloud credential files, SSH keys and the Kubernetes service-account token. - Pivoting. It swapped Kubernetes tokens for temporary AWS credentials, grabbed Azure and GCP tokens, connected to PostgreSQL, Redis and MongoDB, and used stolen GitHub tokens to search whole organizations for more secrets. In one case, a single secrets-manager credential exposed an entire vault.
- Persistence. It added its own SSH key, labeled
bluelocale-foothold, toauthorized_keys. - Triage. Every stolen key was checked against its provider and ranked by value.
How AI keys and Claude Code tokens were abused
This part matters for any team building on LLM APIs. According to CloudSEK:
- Claude Code: stolen OAuth tokens were refreshed and used to run inference billed to the victim's subscription.
- Key validation: stolen keys were tested live through OpenAI Codex, OpenRouter, Azure AI Foundry, OpenCode Zen and Google Gemini.
- AWS Bedrock: where a stolen AWS account didn't yet have access to Anthropic models, a script submitted Anthropic's Bedrock use-case form with the stolen credentials to unlock it.
Why were Claude Code tokens on production servers at all? The Claude Code authentication documentation says that on Linux, Claude Code stores its login in ~/.claude/.credentials.json. CloudSEK doesn't say how the tokens got there. My guess is that developers ran Claude Code under the same user account as the app. A file locked to its owner is still readable by code running as that owner.
Why are AI API keys such valuable targets?
A stolen database password gives an attacker data. A stolen LLM key gives them compute they can resell or burn, billed to someone else.
Sysdig's Threat Research Team coined the term in its original LLMjacking research on stolen cloud credentials. It estimated a worst case of $46,080 per day for one victim, running Claude 2.x on Bedrock at full quota across four regions. A follow-up, Sysdig's report on the growing dangers of LLMjacking, describes attackers enabling models themselves through Bedrock's model-access APIs, the same step React2Keys automated.
Four things make AI credentials especially risky:
- Usage-based billing. Most LLM APIs bill per token, so a key with no spending cap is effectively an open credit line.
- Long-lived OAuth tokens. A refresh token can mint new access tokens long after the theft. Rotating an API key doesn't end a CLI's OAuth session.
- Shared keys. One "company OpenAI key" used by five services means one leak hits all five, and your bill won't show which service was abused.
- Over-broad cloud permissions. An IAM role allowed
bedrock:*can enable new models, not just call the one your app uses.
React2Keys explicitly targeted domain registrar credentials too.
Does React2Shell affect apps that don't use Next.js?
There are two separate questions here.
Is my app vulnerable to CVE-2025-55182? Only if it runs React Server Components on a server through an affected package or framework. Besides Next.js App Router, React's advisory lists React Router's RSC mode, Waku, Parcel RSC, the Vite RSC plugin and RedwoodSDK. A client-only React app served from a CDN is not affected. A NestJS or Express API without RSC is not affected.
Am I exposed to the React2Keys technique? Almost certainly. The harvesting stage has nothing to do with React. Once an attacker can run code in any Node.js process, through a file-upload flaw, a vulnerable dependency or an exposed admin panel, they can read the same things: process.env, readable files, the cloud metadata endpoint and whatever the database role allows. CloudSEK found the same harvesting code reused against Odoo and WordPress targets.
My write-up on how a file upload vulnerability leads to remote code execution (Upload2Shell) shows a different way into the same position.
What should developers check after React2Keys?
These are the checks I would run in our own infrastructure. Keep two things separate:
- Remediation (patching) closes the way in.
- Incident response deals with hosts that may already be compromised.
Patching a compromised host just gives you a patched, compromised host.
Quick reference
| # | Check | What it catches |
|---|---|---|
| 1 | Package versions | Whether you're still vulnerable |
| 2 | Exposure window | Whether to treat the host as compromised |
| 3 | SSH authorized_keys | The React2Keys backdoor and other persistence |
| 4 | Env vars and .env files | Which secrets you must rotate |
| 5 | CI/CD tokens | Org-wide code search and cloning |
| 6 | AWS CloudTrail and Bedrock | Unauthorized model access and new resources |
| 7 | Anthropic and OpenAI usage | Keys used for inference by someone else |
| 8 | Kubernetes service accounts | Pod-level access to cloud roles |
| 9 | MCP servers and agents | Shared credentials with wide reach |
1. Check your package versions
# Read-only: shows installed versions of the affected packages
npm ls next react react-dom \
react-server-dom-webpack react-server-dom-turbopack react-server-dom-parcelCompare the output with the current advisories, not December 2025 blog posts. See the version table below.
2. Decide whether the host was exposed
If a vulnerable version faced the internet at any time after December 3, 2025, treat the host as compromised until you have evidence otherwise. A clean result from CloudSEK's exposure lookup only means you aren't in its dataset.
3. Look for the React2Keys SSH key
CloudSEK published the attacker's public key as an indicator of compromise. These commands only read files:
# Searches for the specific React2Keys persistence key
sudo grep -rnF "AAAAC3NzaC1lZDI1NTE5AAAAINiNfAw552VRo+E3mBu/MHaVsRDcN0BMGuVCjgIyHbb3" \
/root/.ssh/ /home/*/.ssh/ 2>/dev/null
# Searches for the key label CloudSEK reported
sudo grep -rn "bluelocale-foothold" /root/.ssh/ /home/*/.ssh/ 2>/dev/null
# Lists every authorized key fingerprint so you can compare against your inventory
for f in /root/.ssh/authorized_keys /home/*/.ssh/authorized_keys; do
[ -f "$f" ] && echo "== $f" && ssh-keygen -lf "$f"
doneAttackers change keys, so the fingerprint review matters as much as the exact match. Also check cron jobs, systemd units and SSH login history. Take a forensic copy before you remove anything.
4. List every secret the process could read
# Prints environment variable NAMES only (not values) for a running Node process
sudo cat /proc/<PID>/environ | tr '\0' '\n' | cut -d= -f1 | sort
# Finds .env-style files in common app directories
sudo find /srv /app /home -name ".env*" -type f 2>/dev/nullEverything on these lists goes into your rotation plan.
5. Review CI/CD tokens
If a GitHub or GitLab token was on the host, check your organization's audit log for code searches, repository clones and new deploy keys. Then rotate every CI secret that token could reach.
6. Audit AWS CloudTrail and Bedrock activity
# Read-only: looks for Bedrock model-access requests
aws cloudtrail lookup-events \
--lookup-attributes AttributeKey=EventName,AttributeValue=PutUseCaseForModelAccess \
--start-time 2026-11-01T00:00:00Z
# Read-only: recent Bedrock API activity
aws cloudtrail lookup-events \
--lookup-attributes AttributeKey=EventSource,AttributeValue=bedrock.amazonaws.com \
--start-time 2026-11-01T00:00:00Z --max-results 50Look for model-access requests nobody on your team made, new IAM users or access keys, and Lambda functions or EC2 instances you didn't launch. Run the commands in every region you use. lookup-events only covers the last 90 days.
7. Check Anthropic and OpenAI usage
Look for usage spikes between November 9 and 19 and for models you don't normally use. Both the Claude Console and the OpenAI dashboard break usage down by key. Revoke and reissue every key that was on an exposed host. Also log out of Claude Code and Codex sessions on those hosts.
8. Review Kubernetes service accounts
# Read-only: lists what a service account is allowed to do
kubectl auth can-i --list --as=system:serviceaccount:<namespace>:<serviceaccount>"We don't store static keys" is not protection. If a pod's IAM role can read Secrets Manager or call Bedrock, code running in that pod can too.
9. Review MCP servers and AI agents
Any MCP server or agent worker on the same host or in the same pod is in scope. List every token it holds and rotate them. Shared credentials cause the most damage here, as the next section explains.
What I would change in a production application
These are recommendations, not controls I've audited anywhere.
- Move secrets out of environment variables where you can. Load them at startup from a secrets manager and keep them in memory. Protect the vault credential itself, because one such credential exposed a whole vault in React2Keys.
- Give each service its own credentials. The website, API, MCP worker and cron jobs each get their own LLM key, database role and cloud role.
- Scope IAM tightly. The app role should call one Bedrock model in one region. Enabling new models belongs to a platform role behind change control.
- Run Node.js as a non-root user, and keep personal tools like Claude Code or the AWS CLI out of production accounts.
- Set spending limits on every LLM key. The OpenAI guide to managing API projects and spend limits covers per-project caps. Anthropic's console supports per-workspace limits. On Bedrock, use AWS Budgets.
- Practice rotation so it's routine during an incident.
- Alert on the signals this campaign produced: Node processes starting shells, new SSH keys, Bedrock model-access events and LLM usage at unusual hours.
# Illustrative: official Node images include a non-root "node" user
FROM node:22-slim
WORKDIR /app
COPY --chown=node:node . .
RUN npm ci --omit=dev
USER node
CMD ["node", "server.js"]Running as non-root won't stop an attacker reading the app's own environment. It will stop writes to /root/.ssh and keep other users' credential folders out of reach.
Developer security checklist for React2Shell and AI key theft
Remediation
- Upgrade
nextandreact-server-dom-*to the latest patched release in your line - Remove RSC packages from services that don't need them
- Turn on dependency alerts for
nextandreact-server-dom-*
Incident response (any host exposed after Dec 3, 2025)
- Take a forensic snapshot first
- Search
authorized_keys, cron and systemd for persistence - Rotate every secret the host could read
- Revoke Claude Code, Codex and other CLI OAuth sessions
- Audit CloudTrail for Bedrock and IAM changes
- Review LLM provider usage for November 2026
- Audit GitHub or GitLab logs for code search and cloning
Hardening
- One credential per service and environment
- Spending caps and alerts on every LLM project or workspace
- Non-root containers with no personal tools
- IAM roles scoped to exact models, regions and actions
automountServiceAccountToken: falsewhere pods don't need the Kubernetes API- Database roles that aren't table owners, superusers or
BYPASSRLS
Multi-tenant SaaS, MCP servers and PostgreSQL tenant isolation
This is where React2Keys stops being a Next.js story and becomes an architecture story.
Picture a typical AI-enabled SaaS: a Next.js frontend, a NestJS API, an MCP server that gives an agent tools, and PostgreSQL with Row-Level Security (RLS) keeping tenants apart. RLS filters rows per query according to policies you define.
The PostgreSQL documentation on row security policies is clear about the limits: superusers and roles with BYPASSRLS always skip RLS, and table owners skip it too unless you use FORCE ROW LEVEL SECURITY.
CloudSEK reports the attacker opening a read-only superuser Postgres session and searching for columns named key, secret, token and password. If your MCP worker connects as the role that ran your migrations, it probably owns the tables. If it connects as postgres, it's a superuser. Either way, your tenant policies don't apply to it. One RCE could then read every tenant's data, including any OAuth tokens and API keys your customers stored with you.
Check your own database with these read-only queries:
-- Roles that bypass RLS completely
SELECT rolname, rolsuper, rolbypassrls
FROM pg_roles
WHERE rolsuper OR rolbypassrls;
-- Tables with RLS, whether it's forced, and who owns them
SELECT c.relname, c.relrowsecurity AS rls_enabled,
c.relforcerowsecurity AS rls_forced,
pg_get_userbyid(c.relowner) AS owner
FROM pg_class c
WHERE c.relkind = 'r' AND c.relnamespace = 'public'::regnamespace;If your app's runtime role is in the first result, or owns the tables in the second, RLS isn't protecting you from it.
A safer layout looks like this (illustrative, so adapt and test it first):
-- Migrations run as app_owner; the application connects as app_runtime
CREATE ROLE app_runtime LOGIN NOSUPERUSER NOBYPASSRLS;
GRANT SELECT, INSERT, UPDATE, DELETE ON orders TO app_runtime;
ALTER TABLE orders ENABLE ROW LEVEL SECURITY;
ALTER TABLE orders FORCE ROW LEVEL SECURITY;
CREATE POLICY tenant_isolation ON orders
USING (tenant_id = current_setting('app.tenant_id', true)::uuid)
WITH CHECK (tenant_id = current_setting('app.tenant_id', true)::uuid);In NestJS, set the tenant once per transaction with SELECT set_config('app.tenant_id', $1, true). The true limits the setting to that transaction, so a pooled connection doesn't carry it into the next request.
Most RLS tutorials leave out one point: session-variable RLS protects you from application bugs, not from an attacker who controls the connection. Someone with RCE and the runtime password can call set_config with any tenant ID they like. RLS protects you from a missing WHERE clause, but not from a compromised worker. To limit a compromised worker, you have to limit what its credential can reach:
- Give each agent and MCP worker its own database role, limited to the tables its tools actually need. An inventory tool shouldn't be able to read an
api_keystable. - Use short-lived, tenant-scoped tokens for tool calls instead of one long-lived connection string that reaches every tenant.
- Encrypt stored customer credentials with a key the database role can't read on its own, such as a KMS key behind an IAM policy.
- Keep agent workers away from the web tier, so a compromised Next.js process can't read the worker's credentials.
AI agents raise the stakes because they're designed to hold many credentials at once. An agent worker with tenant-wide access is the most valuable target in the system, and it often gets the least hardening because it started life as a prototype.
For a deeper walkthrough, see my guides to building multi-tenant SaaS on PostgreSQL with Row-Level Security and building an MCP server for a warehouse management system.
Which React and Next.js versions are safe?
The "fixed" versions have changed several times since the first patch:
| Date | Issue | React fixed versions | Next.js |
|---|---|---|---|
| Dec 3, 2025 | CVE-2025-55182 RCE (CVSS 10.0) | 19.0.1, 19.1.2, 19.2.1 | 15.0.5 to 16.0.7 lines |
| Dec 11, 2025 | CVE-2025-55184 and CVE-2025-67779 DoS, CVE-2025-55183 source exposure | 19.0.3, 19.1.4, 19.2.3 | 14.2.35, 15.x and 16.0.10 |
| Jan 26, 2026 | CVE-2026-23864 DoS | 19.0.4, 19.1.5, 19.2.4 | 15.x and 16.1.5 |
| Jul 2026 | CVE-2026-44907 DoS | 19.0.8, 19.1.9, 19.2.8 | Check nextjs.org |
| Oct 2026 | CVE-2026-126187 RCE | 19.0.9, 19.1.10, 19.2.9, 19.3.1 | Check nextjs.org |
For details, read React's follow-up advisory on React Server Components DoS and source code exposure, the Next.js December 2025 security update, Vercel's summary of CVE-2026-23864 and the GitLab advisory for CVE-2026-126187.
The Next.js team reported in how it uses AI to make Next.js more secure that it had published 51 security advisories in 2026 by mid-November, up from 14 in 2025. Treat Next.js upgrades as a monthly routine, not a one-off after an incident.
Final takeaway
React2Shell gave the attacker a way into the Node process. What made React2Keys worth running was everything that process could read. Every server holding a live, uncapped, tenant-wide credential is worth attacking, whatever framework it runs. Patch so the next attacker can't get in the same way. Then reduce what each process can read and spend, because the next RCE will probably come through a different bug.
Frequently Asked Questions
What is React2Keys?
React2Keys is CloudSEK's name for an automated credential-theft campaign it reported on November 30, 2026. CloudSEK says the attacker exploited React2Shell (CVE-2025-55182) on unpatched Next.js servers between November 9 and 19, 2026, and stole more than 50,000 credentials from over 19,000 victims. These included AI provider keys, cloud identities, database passwords and Claude Code tokens. No one has independently verified these figures yet.
What is React2Shell (CVE-2025-55182)?
React2Shell is a critical remote code execution flaw in React Server Components, disclosed on December 3, 2025 with a CVSS score of 10.0. Unsafe handling of data sent to Server Function endpoints let an unauthenticated attacker run code on the server with one HTTP request. It affected React 19.0.0 to 19.2.0 server packages and frameworks built on them, including Next.js App Router.
Is my app affected if I don't use Next.js?
You're only vulnerable to CVE-2025-55182 if you run React Server Components on a server through an affected package or framework. Client-only React apps and NestJS or Express APIs without RSC aren't affected. The credential-theft technique works after any remote code execution, though, so every Node.js backend should still limit what its process can read.
Does patching React2Shell remove an attacker who already got in?
No. Patching closes the entry point, but it doesn't revoke stolen keys, end OAuth sessions or remove SSH keys an attacker planted. CloudSEK says the React2Keys attacker added its own SSH key to authorized_keys. If your host was exposed, rotate every secret it could read and check it for persistence.
Which versions fix React2Shell and the follow-up bugs?
The original fix was React 19.0.1, 19.1.2 and 19.2.1, but later advisories raised the minimum. By January 2026 it was 19.0.4, 19.1.5 and 19.2.4, and newer fixes followed in July and October 2026. Upgrade to the latest patch in your release line and confirm it on react.dev and nextjs.org.
How were Claude Code tokens and AI keys abused?
CloudSEK says the attacker refreshed stolen Claude Code OAuth tokens and ran inference billed to the victims' subscriptions. It tested stolen keys through OpenAI Codex, OpenRouter, Azure AI Foundry, OpenCode Zen and Gemini. On AWS, it used stolen credentials to submit Anthropic's Bedrock use-case form and unlock Claude models.
What is LLMjacking?
LLMjacking is Sysdig's term, coined in May 2024, for using stolen cloud credentials or API keys to run hosted AI models at the victim's expense. Sysdig estimated a worst case of $46,080 per day for one victim on AWS Bedrock. Scoped keys, spending limits, alerts on model-access changes and fast rotation reduce the damage.
References
- CloudSEK: React2Keys AI-powered React2Shell credential theft campaign
- React: Critical security vulnerability in React Server Components (CVE-2025-55182)
- React: Denial of service and source code exposure in React Server Components
- Next.js: Security advisory CVE-2025-66478
- Next.js: December 11, 2025 security update
- Next.js: How we're using AI to make Next.js more secure
Adding AI to your system, or building a new AI feature?
Most of the work sits in the data plumbing rather than the model. Send us the workflow you want to automate and we will tell you what is feasible on your current stack.




