Is Your Publicly Exposed Next.js Server Safe? How React2STEAL Scans for and Exploits Servers from Hijacked GitHub Accounts, and How to Check

Is Your Publicly Exposed Next.js Server Safe? How React2STEAL Scans for and Exploits Servers from Hijacked GitHub Accounts, and How to Check

React2STEAL uses hijacked GitHub accounts' Actions to scan and exploit unpatched Next.js servers, then puts stolen secrets in public repos. This covers the attack flow and how to check versions, IMDS and GitHub accounts, from primary sources.
2026.12.01

This page has been translated by machine translation. View original

Hi there! I'm Yuji Nishimura from the Ops team!

On November 18, 2026, OpenSourceMalware published its findings on a series of attacks it named "React2STEAL". The attacks use GitHub Actions on hijacked GitHub accounts to search the internet for Next.js servers and exploit unpatched vulnerabilities. The stolen environment variables and credentials were committed to public repositories of the same accounts.

The two vulnerabilities that were exploited are both known issues that were fixed in 2025. What is new is how the attack is put together: it scans from the GitHub Actions of a hijacked account and places the stolen secrets (API keys, tokens, passwords, and so on) in that account's public repositories. This article is for people who expose Next.js or frameworks that support React Server Components (RSC) to the internet, and for people who manage GitHub accounts or organizations. It walks through the flow of the attack and how to check whether your servers or GitHub accounts have been affected.

Conclusion first: what to check and what to do

What to check What to do
Whether Next.js is at or after the fixed version for React2Shell (CVE-2025-55182) (15.x / 16.x using the App Router are affected) Update to the latest 16.x (16.4.6 at the time of writing). If you can't move right away, go to the latest 15.5.x (15.5.29). The 14.x and earlier, 15.0–15.4, and 16.0–16.3 lines don't have all the fixes for the Critical-severity vulnerabilities that came out in 2026
Whether Next.js is at or after the fixed version for CVE-2025-29927 (12.3.5 / 13.5.9 / 14.2.25 / 15.2.3) Update as above. If you can't update right away, drop the external x-middleware-subrequest header at a front-end proxy
For RSC-capable frameworks other than Next.js, whether react-server-dom-* is at or after the latest patch (19.0.9 / 19.1.10 / 19.2.9 / 19.3.1) Update to the latest patch of your line, including transitive dependencies
Whether IMDSv2 is required on your EC2 instances (HttpTokens is required) Require IMDSv2. Also narrow images.remotePatterns to only the sources you need to fetch from
Whether your web server or WAF logs contain indicators of compromise (header indicators only if you record headers), and whether the server has made outbound requests to AI providers the app doesn't use If you find any, replace every secret the process could read. Copies remain even if the repository holding the stolen data is deleted, so don't wait for deletion
Whether your or your organization's GitHub accounts have repositories or workflow runs you don't remember creating If you find any, revoke tokens, app authorizations, and SSH keys, and replace the GitHub Actions secrets of the repositories that account can write to

What happened

The following is based on OpenSourceMalware's original post.

  • Threat intelligence researchers found 38 GitHub repositories that scan for and exploit React2Shell and CVE-2025-29927. OpenSourceMalware widened its investigation to 45, which had been created in three waves
  • The creation dates are October 22, 2026 (at least 26 created in about 7 minutes), November 11 (8), and November 14 (5; no results committed at the time of the investigation). Based on dates in comments in the scripts, they may have been running in September–October, but OpenSourceMalware says this is unverified
  • As of November 17, results were still being committed about every 11 minutes
  • At least 1,281 victim hostnames (about 1,100 domains) were affected, which OpenSourceMalware treats as a lower bound. The 11 repositories it could access alone held about 9,100 ZIP files, about 3,800 JSON files, and about 3,000 plaintext records, about 7.4 GB in total
  • The most common stolen items were database connection URLs, payment service keys, and AI provider keys

The two vulnerabilities exploited are as follows.

  • CVE-2025-55182 (React2Shell): unauthenticated remote code execution in React Server Components (CVSS 10.0). Published December 3, 2025. It affects 19.0.0 / 19.1.0 / 19.1.1 / 19.2.0 of react-server-dom-webpack / react-server-dom-parcel / react-server-dom-turbopack, and was fixed in 19.0.1 / 19.1.2 / 19.2.1. RSC-capable frameworks such as Next.js, React Router, Waku, and @vitejs/plugin-rsc are also affected
  • CVE-2025-29927: an issue where authorization by Next.js middleware can be bypassed with a request carrying an internal header (CVSS 9.1). Published March 21, 2025. Fixed in 12.3.5 / 13.5.9 / 14.2.25 / 15.2.3. There is no fixed version for 11.x, and the advisory describes a workaround

In addition, the attackers also tried server-side request forgery (SSRF) using Next.js's image optimization endpoint (/_next/image). The goal was to obtain cloud credentials available from the instance metadata service (IMDS) address 169.254.169.254.

Flow of the attack: from a stolen token to a publicly readable repository

The diagram below is a conceptual diagram I made based on OpenSourceMalware's research. After scanning, the attacker first tries to exploit React2Shell, and if that doesn't work, switches to the middleware bypass and SSRF via /_next/image. On either path, the information obtained is placed in the same public repository. On servers where React2Shell is patched and the metadata can't be reached via IMDSv1, the flow stops partway through the diagram.

  1. Prerequisites
    • Attacker side: a GitHub token with write permission and a list of target hostnames. OpenSourceMalware believes most of the repository owners are victims. It also believes the tokens were stolen, but says how they were obtained is unknown. The hostname list is presumed to have been built from Certificate Transparency logs (public records of issued TLS certificates), and one repository held about 18 million entries
    • Victim server side: a React / Next.js app exposed to the internet with either of the two vulnerabilities above unpatched. Considering how Next.js and AWS work, an SSRF can obtain cloud credentials only on an EC2 instance where images.remotePatterns is broad enough to allow the metadata address (on 16.x, additionally with dangerouslyAllowLocalIP set to true, or with GHSA-cjq9-62q9-8jv4, described later, unpatched) and the metadata is accessible via IMDSv1
  2. Intrusion and exploitation
    • The attacker starts a workflow from the API using workflow_dispatch (a trigger started manually or via the API) and specifies a target list file (about 20,000 hosts per file) as input. OpenSourceMalware believes a single controller is starting them by using many accounts in turn
    • On GitHub-provided ubuntu-latest runners, it narrows down hosts that appear to use Next.js, and tries exploiting React2Shell against the remaining hosts with 7 kinds of requests
    • For hosts where React2Shell didn't work, it tries the CVE-2025-29927 middleware bypass and requests that use /_next/image for SSRF to obtain AWS role credentials from instance metadata
    • On servers where the React2Shell exploit succeeds, the attacker's JavaScript runs inside the app's Node.js process and collects information
  3. Impact
    • The script collects the process's environment variables, hostname, network information, cloud credential files, and Kubernetes tokens. Newer versions of the script also exfiltrate the contents of .env and configuration files, up to 300 KB per victim host. From servers where the SSRF succeeds, AWS role credentials are also taken
    • For keys of 10 AI providers, it actually called the inference API from the victim server to verify that the keys were valid
    • The stolen information is returned to the runner as the response to the exploit request, and is committed to the same public repository using the workflow's contents: write permission. It is readable by anyone

Why it works

The attacker doesn't need their own servers

The compute is GitHub's runners, and the place to store the stolen data is the victim's public repository. GitGuardian writes that the only manual step is committing the target list to the repository.

From here on is my own analysis. The scan source IPs are in GitHub's runner ranges. From the victim server's point of view, the stolen information is simply returned as the response to the exploit request, and the only outbound traffic is to legitimate AI providers to verify AI keys. So mechanisms that block based on source IP reputation (such as lists of malicious IPs) or traffic to suspicious destinations are likely to have difficulty stopping this attack. The defender's countermeasures center on updating servers and replacing leaked secrets.

Stolen GitHub tokens remain unrevoked

According to OpenSourceMalware, many of the accounts that own React2STEAL repositories were also used in another attack, wfx-loot, which has been active since November 10. wfx-loot is an attack that uses a hijacked account to inject code that steals CI secrets into repositories the account can write to. 25 repositories had a wfx-docs branch, and in 24 of them the placed file was byte-for-byte identical to wfx-loot's reconnaissance file. However, OpenSourceMalware does not conclude that they are the same attacker, and based on differences in tooling and technique it views them as somewhat separate attacks.

Whether or not the attackers are the same, the hijacked accounts kept being used in multiple attacks while the stolen tokens went unrevoked. OpenSourceMalware writes that a stolen token isn't used once and discarded; whoever holds it keeps looking for ways to use it.

Even after fixes are released, servers that aren't updated remain

Even nearly a year after the React2Shell fix, unpatched servers remained on the internet. Chainguard points out that even if the top-level React is new, the transitive dependency react-server-dom-* may be pinned to an old version.

Even if deleted, copies remain once published

OpenSourceMalware writes that even if a repository is deleted, the data remains in clones, forks, caches, and Git history. GitGuardian also says copies may remain in forks, clones, and scrapers.

Check whether your environment is affected

The commands listed here were not run for this article. I show them only within the scope of usage in the official npm and AWS documentation.

Whether production Next.js and React are at or after the fixed versions

Check out the commit deployed to production, install dependencies with something like npm ci, and then check the Next.js version with npm ls (npm ls reads the installed node_modules). If you use pnpm or Yarn, check in the same way with the respective tools.

npm ls next

Compare the displayed next@ version against the fixed versions of the following two vulnerabilities. According to the Next.js advisory (GHSA-9qr9-h5gf-34mp), CVE-2025-55182 affects Next.js 15.x and 16.x using the App Router, and canary releases from 14.3.0-canary.77 onward. According to the Next.js announcement, stable 13.x and 14.x, the Pages Router, and the Edge Runtime are not affected by React2Shell. The minimum fixed versions for React2Shell are as follows.

Line Minimum fixed version
15.0.x 15.0.5
15.1.x 15.1.9
15.2.x 15.2.6
15.3.x 15.3.6
15.4.x 15.4.8
15.5.x 15.5.7
16.0.x 16.0.7

The 16.1 line was fixed in 16.1.0-canary.12, and stable releases from 16.1.0 onward include the fix. For the other one, CVE-2025-29927, if you use middleware, check whether you are on 12.3.5 / 13.5.9 / 14.2.25 / 15.2.3 or later. There is no fixed version for 11.x.

However, stopping at the fixed versions listed here is not enough. Next.js has continued to publish Critical-severity advisories in 2026, and only the latest patches of 15.5.x and 16.x have all the fixes. For example, there are two unauthenticated remote code execution issues in the image optimization API (GHSA-2xp9-vwfh-vxw4 when handling AVIF files, and GHSA-2464-fhr4-w9xw when handling SVG files). Only 15.5.28 and later and 16.4.1 and later include both fixes. For the 14.x and earlier, 15.0–15.4, and 16.0–16.3 lines, even raising to the latest patch of that line (such as 14.2.35 or 15.4.11) does not fix it. The upgrade table in React's announcement (for example, 15.5.10 for 15.5.x and 16.0.11 for 16.0.x) includes the denial-of-service and source code exposure CVEs added through January 26, 2026, and does not include CVEs after that.

If you use an RSC-capable framework other than Next.js, check the version of react-server-dom-*, including transitive dependencies, as Chainguard points out above. The React2Shell fixes are 19.0.1 / 19.1.2 / 19.2.1, but on October 14, 2026, another unauthenticated remote code execution in RSC (CVE-2026-126187) was published and fixed in 19.0.9 / 19.1.10 / 19.2.9 / 19.3.1.

npm ls react-server-dom-webpack react-server-dom-parcel react-server-dom-turbopack

Whether IMDSv2 is required on EC2

If you run on EC2, check whether HttpTokens in the instance metadata options is required. If it is optional, metadata can also be retrieved via IMDSv1. describe-instances only looks at the currently configured Region, so run it with --region for each Region you use.

aws ec2 describe-instances \
  --query 'Reservations[].Instances[].[InstanceId,MetadataOptions.HttpTokens]' \
  --output table

With IMDSv2, you first obtain a session token with a PUT request, and you can't read metadata without attaching that token to a header. An SSRF that merely passes a URL, like /_next/image, can't perform this step (this is my own analysis).

Whether logs and usage show traces of the attack

OpenSourceMalware lists the following as indicators of compromise and recommends checking request logs and WAF logs.

  • Requests with the x-middleware-subrequest header repeated 5 times (attempts at CVE-2025-29927)
  • Requests where /_next/image?url= points to the metadata address 169.254.169.254 (SSRF attempts. Traffic to this address is itself normal on cloud servers, so a request of this form arriving from outside is the clue)
  • Multipart requests with the Next-Action: x header and the boundary string bissa_cve_boundary (React2Shell attempts. Of the 7 kinds of attempts, one uses a random boundary string)
  • Outbound requests from the web server to AI provider APIs with a desktop Chrome 126 User-Agent (verifying stolen keys)

nginx's default combined format records the request line (the URL including the query string), Referer, and User-Agent, but not other request headers. So the /_next/image?url= indicator can be searched for in ordinary access logs, but the x-middleware-subrequest and Next-Action indicators are usable only if you record headers. In addition, outbound requests from the web server to AI providers the app doesn't use, and sudden changes in the usage or balance of AI keys, are also clues.

Whether your GitHub accounts have unfamiliar repositories

Check whether your or your organization's accounts have any of the following (as described by OpenSourceMalware and Chainguard).

  • Repositories you don't remember creating, with names of ci-wk- followed by a number (React2STEAL). Because names can be changed, OpenSourceMalware recommends looking for repositories that contain batch_output.py, prefilter_nextjs.py, and fast_recon.js together
  • Commits whose author is w <w@w> (React2STEAL result commits)
  • A wfx-docs branch, or a PR titled "docs: dependency audit notes" (wfx-loot)
  • Gaps in workflow run numbers (wfx-loot deletes run records after execution, so they remain as gaps)

Countermeasures

Update React and Next.js

As confirmed in "Whether production Next.js and React are at or after the fixed versions", raise Next.js to the latest 16.x (16.4.6 at the time of writing) or the latest 15.5.x (15.5.29), and for RSC-capable frameworks other than Next.js, raise react-server-dom-* to the latest patch of your line. If you use 14.x or earlier, 15.0–15.4, or 16.0–16.3, the update crosses lines. OpenSourceMalware also says that updates take time for planning and testing, so it recommends first checking whether attacks have reached you and reducing exposure in the meantime.

For CVE-2025-29927, the Next.js advisory lists a workaround for when you can't update right away: keep requests containing the external x-middleware-subrequest header from reaching Next.js. It also says deployments on Vercel are protected automatically.

Reduce the damage from SSRF to metadata

For instances that were optional in the check "Whether IMDSv2 is required on EC2", require IMDSv2. According to the AWS documentation, you can set it on existing instances with the following command. It says that before making it required, you should confirm in the CloudWatch MetadataNoToken metric that IMDSv1 calls are at 0.

aws ec2 modify-instance-metadata-options \
    --instance-id i-1234567890abcdef0 \
    --http-tokens required \
    --http-endpoint enabled

On the Next.js side, narrow the sources for fetching external images to only those you need with images.remotePatterns. dangerouslyAllowLocalIP, added in Next.js 16.0.0, is false if nothing is configured, and does not allow image optimization from local IPs within the same network. The documentation says to set it to true only if you understand the SSRF risk. However, in 16.x until it was fixed in the 16.3 line, if an attacker controlled the DNS of a host allowed by remotePatterns, there was an issue that could reach private IPs and the like (GHSA-cjq9-62q9-8jv4). Put only hosts whose DNS you can trust in remotePatterns. Because 15.x and earlier don't have dangerouslyAllowLocalIP, narrowing with remotePatterns and requiring IMDSv2 are the core of the defense.

If there are signs of exploitation, replace all secrets

According to OpenSourceMalware, on servers that received matching requests, you need to replace every secret the process could read, including ones that don't look like keys. Treat configuration files as leaked too, and check the usage history of any AI provider keys the server held. Because the script tries keys from the victim server, those calls become hard to tell apart from your own traffic.

Also, variables with NEXT_PUBLIC_ are embedded in code delivered to the browser, so values put there are public regardless of whether an attack occurred. OpenSourceMalware writes that if you have set NEXT_PUBLIC_OPENAI_API_KEY, one of the names the script looks for, you should replace it in any case.

Both OpenSourceMalware and GitGuardian put replacing and revoking secrets, not deleting repositories, at the center of the response.

Stop hijacked GitHub accounts

If the check "Whether your GitHub accounts have unfamiliar repositories" turns up suspicious repositories or commits, revoke that account's personal access tokens, OAuth and GitHub App authorizations, and SSH keys. OpenSourceMalware recommends reviewing whether there are repositories, branches, or workflow runs you don't remember creating, including ones that don't match the indicator names. Many of the hijacked accounts were also used in wfx-loot, which steals CI secrets, so it seems wise to also replace the GitHub Actions secrets registered in the repositories that the account can write to.

Summary

  • React2STEAL is a series of attacks that scan for and exploit unpatched Next.js / React from the GitHub Actions of hijacked GitHub accounts. The stolen secrets were placed in public repositories of the same accounts. Both of the exploited vulnerabilities have been fixed
  • There are four things to check: the production Next.js version (and transitive react-server-dom-* for RSC-capable frameworks other than Next.js), the EC2 IMDSv2 setting, web server and WAF logs, and whether your GitHub accounts have repositories you don't remember creating. Don't stop at the React2Shell fixed versions for Next.js; go up to the latest 16.x or 15.5.x, and require IMDSv2
  • If there are signs of exploitation on a server, replace the secrets the server could read without waiting for repositories to be deleted. If a GitHub account has repositories you don't remember creating, revoke tokens, app authorizations, and SSH keys. Many of the hijacked accounts were also used in another attack, wfx-loot, while the stolen tokens went unrevoked

I hope this helps someone.


References:


セキュリティ対策もお任せください

セキュリティ相談会では、御社の環境に合わせて、どこを確認し、どの対策から進めるかを一緒に考えます。「今の設定で大丈夫か、少し気になる」くらいの段階から、喫緊の課題までオンラインで無料でご相談いただけます。ぜひご活用ください。

セキュリティ相談会

セキュリティ相談会の詳細を見る

Share this article