Security Update: Multiple vulnerabilities in React Router
The React Router team has disclosed seven security vulnerabilities in React Router. Most have limited impact on Netlify, but if your site uses React Router, you should update it. If your site doesn’t use React Router, you don’t need to do anything.
Am I affected?
Your site may be affected if it uses React Router 6, 7, or 8, either directly or through a framework built on it. These frameworks include, but aren’t limited to:
- Remix 2, which uses React Router 6
- Shopify Hydrogen, which uses React Router 7
Sites that don’t use React Router aren’t affected.
To check:
- In your site’s folder, install your dependencies, then list the installed React Router packages, using the commands for your package manager in the table below. In a monorepo, run them in the folder of the site you deploy, not the repository root. This lists every installed copy and its version, including copies that another framework, such as Remix 2, brings in. It only sees installed packages, so install first.
- This checks the code in your project folder, not what’s deployed. Older deploys keep running the code they were built with, as explained under “What should I do?”.
- You can also open your project’s
package.jsonfile and look forreact-routeror packages starting with@react-router/. A framework built on React Router may not list it there, so listing the installed packages is more reliable. - If an AI tool built your site and you’re not sure, ask it: “Does this project use React Router, directly or through another package? If so, which version?”
- If you have a Credit plan with Agent Runners, you can ask the same question in Ask mode.
| Step | npm | pnpm | Yarn |
|---|---|---|---|
| Install dependencies | npm install |
pnpm install |
yarn install |
| List installed versions | npm ls react-router @react-router/node @react-router/serve @react-router/dev |
pnpm why react-router @react-router/node @react-router/serve @react-router/dev |
yarn why react-router, then repeat for @react-router/node, @react-router/serve, and @react-router/dev |
| Update within your version range | npm update react-router react-router-dom @react-router/node @react-router/serve @react-router/dev |
pnpm update react-router react-router-dom @react-router/node @react-router/serve @react-router/dev |
Install the patched version for your major version directly (next row) |
| Install a patched version directly | npm install react-router@^7.18.6 (7.x) or npm install react-router@^8.5.1 (8.x) |
pnpm add react-router@^7.18.6 (7.x) or pnpm add react-router@^8.5.1 (8.x) |
yarn add react-router@^7.18.6 (7.x) or yarn add react-router@^8.5.1 (8.x) |
What should I do?
If your site uses React Router 7 or 8, update it to a patched version and deploy again:
- Check that your
package.jsonlists React Router packages with a^or~version range, such as^7.17.0. A range such as*lets the update move you to a new major version, which can include breaking changes. - In the same folder, run the update command for your package manager from the table above. With npm and pnpm, it only installs versions that your
package.jsonallows, so it keeps you on your current major version. With Yarn, install the patched version for your current major version. - List the installed versions again and compare each package with its patched version below. If any are still affected:
- If the affected copy is nested under another package, such as
react-router-domor a framework, update that package. Installingreact-routeron its own doesn’t replace a copy that another package pins. - Otherwise, install a patched version directly, such as
react-router@^7.18.6orreact-router@^8.5.1, and do the same for any@react-router/packages you use. Then list the installed versions again to confirm every copy is patched.
- If the affected copy is nested under another package, such as
- Commit every file the update changed, including
package.jsonand your lockfile, such aspackage-lock.json,pnpm-lock.yaml, oryarn.lock, then deploy.
If an AI tool built your site, you can ask it to “update React Router to the latest patched version”.
The patched versions are:
react-router8.5.1 or later (for React Router 8.x)react-router7.18.5 or later (for React Router 7.x)@react-router/node,@react-router/serve, and@react-router/dev8.5.1 or later (for React Router 8.x)@react-router/nodeand@react-router/serve7.18.6 or later (for React Router 7.x)
React Router 6 and Remix 2: there is no patched React Router 6.x release for GHSA-x8j4-g9rr-8j87 or GHSA-7m2v-44vx-v55w, and npm update can’t fix them. To fix these two issues, you need to upgrade to a patched React Router 7 or 8 release listed above. Remix 2 apps use React Router 6, so they need to move to React Router 7.
Make sure the IS_RR_BUILD_REQUEST environment variable is not set on your site or as a shared environment variable on your team. React Router sets it automatically during builds, and it should never be configured in your environment variables. If you find it, remove it, then create and publish a new deploy. Existing deploys keep the environment variables they were deployed with, so older deploys created while the variable was set stay affected until they’re deleted (see the next paragraph).
Note that older deploys keep running the code they were built with. Publicly available deploy previews and older production deploys may remain vulnerable until they are automatically deleted, and Netlify never automatically deletes the most recent successful deploy of each branch, so branch deploys can stay vulnerable indefinitely. If you’ve locked auto publishing, Netlify builds your patched deploy but doesn’t publish it, so publish it manually. You can’t delete a deploy while it’s published. Check your deploys and delete vulnerable ones manually.
Vulnerabilities
| Vulnerability | Affected versions | Fixed in |
|---|---|---|
| GHSA-2rq8-3rm6-2w8f - Server-rendering DoS | react-router 7.0.0–7.18.4, 8.0.0–8.5.0 |
7.18.5, 8.5.1 |
| GHSA-qhgm-jj2j-75wj - Prototype pollution | react-router 7.0.0–7.18.4, 8.0.0–8.5.0 |
7.18.5, 8.5.1 |
| GHSA-mp5r-736v-j8x9 - Node.js server DoS | @react-router/node 7.0.0–7.18.5, @react-router/serve 7.9.2–7.18.5, @react-router/node, @react-router/serve, @react-router/dev 8.0.0–8.3.0 |
7.18.6, 8.3.1 |
| GHSA-x8j4-g9rr-8j87 - Route-matching DoS | react-router 6.0.0–7.18.2, 8.0.0–8.3.0 |
7.18.3, 8.3.1 |
| GHSA-mjj8-rxh9-q8f5 - RSC redirect XSS | react-router 7.11.0–7.18.3, 8.0.0–8.3.x |
7.18.4, 8.4.0 |
| GHSA-8wpx-2pj4-ggvx - CSRF | react-router 7.12.0–7.18.2, 8.0.0–8.3.0 |
7.18.3, 8.3.1 |
| GHSA-7m2v-44vx-v55w - Open redirect | react-router 6.4.0–7.18.2, 8.0.0–8.3.0 |
7.18.3, 8.3.1 |
Impact on Netlify
GHSA-2rq8-3rm6-2w8f and GHSA-x8j4-g9rr-8j87 (denial of service)
In short: someone could send specially crafted requests that make your site slow to respond.
These are server-side denial-of-service (DoS) vulnerabilities. On Netlify, this has minimal impact: our autoscaling serverless architecture means that a malicious request resulting in a crashed or hung function does not affect other requests. However, active exploitation could increase your function costs. GHSA-x8j4-g9rr-8j87 can also slow down a visitor’s browser during client-side navigation. Regardless of hosting provider, all apps on affected versions may be affected in the browser.
GHSA-qhgm-jj2j-75wj (prototype pollution)
In short: in a rare setup, an attacker could tamper with data your site’s server code relies on.
On the server, this issue only matters if a build-only React Router setting is present while your site is running. Netlify does not carry that setting from your build into production, and already blocks the related request headers before they reach Netlify Functions as well as Edge Functions. Most Netlify projects are not affected on the server. The only exception is a site where someone has added this setting as an environment variable, either on the site or as a shared environment variable on the team (see above). Regardless of hosting provider, all apps on affected versions should upgrade.
GHSA-mp5r-736v-j8x9 (Node.js server DoS)
In short: a specially crafted request could crash a self-hosted React Router server. Netlify doesn’t use that server.
This vulnerability affects the Node.js server that ships with @react-router/node, @react-router/serve, and @react-router/dev. Netlify does not run this server for deployed projects, and Netlify rejects the malformed requests involved, therefore Netlify projects are not affected. We still recommend upgrading.
GHSA-mjj8-rxh9-q8f5 (XSS in RSC redirects)
In short: with an experimental feature that Netlify doesn’t support, an attacker could run their own code on your site.
This only affects React Router’s experimental React Server Components (RSC) modes. Netlify’s React Router adapter does not support RSC, so Netlify projects are not affected. Regardless of hosting provider, apps using experimental RSC modes that redirect to untrusted destinations may be vulnerable.
GHSA-8wpx-2pj4-ggvx (CSRF)
In short: an attacker could trick a signed-in visitor into submitting a form on your site without meaning to.
To exploit this, an attacker needs to serve plain-HTTP content on your site’s own domain. Netlify serves every site over HTTPS and redirects plain-HTTP requests. Browsers also never load *.netlify.app domains over plain HTTP, so on *.netlify.app domains, this is very unlikely to be exploitable. Custom domains don’t get this browser protection automatically. To get it, send a Strict-Transport-Security header from your site. Browsers only apply this header after a first visit over HTTPS. To also protect first visits, add your domain to the HSTS preload list.
GHSA-7m2v-44vx-v55w (open redirect)
In short: a link to your site could send visitors on to an attacker’s site, such as a fake sign-in page.
Apps that redirect to a destination taken from user input, such as a returnTo query parameter after login, may send visitors to an external site. Regardless of hosting provider, all apps redirecting to destinations from user input may be vulnerable. Upgrading fixes React Router’s own navigation, but your code should also check that a redirect destination stays on your site before redirecting.