Seven security advisories for React Router were disclosed this week, covering denial of service, prototype pollution, XSS, CSRF and open redirects. If your React app uses React Router 6, 7 or 8, directly or through a framework such as Remix 2 or Shopify Hydrogen, you should check your versions today.
This guide explains which versions are affected, how to find every installed copy (including ones hidden inside frameworks), how to upgrade safely, and what code-level fixes you still need after upgrading. It is based on Netlify’s 18 November 2026 changelog summary of the React Router team’s advisories.
The seven advisories at a glance
| Advisory | Issue | Affected | 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; node/serve/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 | XSS in RSC redirects | 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 |
The versions you want
- React Router 8:
react-router8.5.1 or later, plus@react-router/node,@react-router/serveand@react-router/dev8.5.1 or later. - React Router 7:
react-router7.18.5 or later, and@react-router/nodeand@react-router/serve7.18.6 or later. The simplest approach is to move everything to 7.18.6. - React Router 6 and Remix 2: there is no patched 6.x release for the route-matching DoS (GHSA-x8j4-g9rr-8j87) or the open redirect (GHSA-7m2v-44vx-v55w). To fix those you need to move to React Router 7 or 8. Remix 2 uses React Router 6, so Remix 2 apps need to migrate to React Router 7.
Step 1: Find every installed copy
Checking package.json isn’t enough, because a framework can bring in its own copy. Install dependencies first, then list what’s actually installed. Run this in the folder of the app you deploy, not the monorepo root:
# npm
npm install
npm ls react-router @react-router/node @react-router/serve @react-router/dev
# pnpm
pnpm install
pnpm why react-router @react-router/node @react-router/serve @react-router/dev
# Yarn (repeat for each @react-router/ package)
yarn install
yarn why react-router
If you want to script it in CI, here’s a small Node.js check that fails the build when an unpatched react-router is found:
// scripts/check-react-router.mjs
import { execSync } from 'node:child_process';
const tree = JSON.parse(
execSync('npm ls react-router --all --json', { encoding: 'utf8' }),
);
const minimum = { 7: [7, 18, 5], 8: [8, 5, 1] };
const bad = [];
function walk(deps = {}) {
for (const [name, info] of Object.entries(deps)) {
if (name === 'react-router' && info.version) {
const [maj, min, pat] = info.version.split('.').map(Number);
const need = minimum[maj];
const ok =
need &&
(min > need[1] || (min === need[1] && pat >= need[2]));
if (!ok) bad.push(info.version);
}
walk(info.dependencies);
}
}
walk(tree.dependencies);
if (bad.length) {
console.error('Unpatched react-router versions:', [...new Set(bad)]);
process.exit(1);
}
console.log('react-router looks patched');
Any 6.x copy is flagged, which is intended: 6.x has no fix for two of the issues.
Step 2: Upgrade within your major version
Make sure your package.json uses a ^ or ~ range (such as ^7.17.0), not *, so an update can’t jump to a new major version. Then:
# npm
npm update react-router react-router-dom @react-router/node @react-router/serve @react-router/dev
# pnpm
pnpm update react-router react-router-dom @react-router/node @react-router/serve @react-router/dev
# or install a patched version directly
npm install react-router@^7.18.6 # 7.x
npm install react-router@^8.5.1 # 8.x
With Yarn, install the patched version for your major directly. Then list the installed versions again. If an old copy is nested under another package, such as react-router-dom or a framework, update that package; installing react-router alone won’t replace a copy another package pins.
Finally, commit package.json and your lockfile, and redeploy.
Step 3: Don’t forget old deployments
Patching your repo doesn’t patch builds that are already running. Netlify specifically warns that deploy previews, branch deploys and older production deploys keep the code they were built with. Wherever you host, check for preview or staging environments that are still publicly reachable and rebuild or remove them.
Netlify also says the IS_RR_BUILD_REQUEST environment variable should never be set in your environment, because React Router sets it automatically during builds and its presence at runtime is related to the prototype pollution issue. If you find it in your hosting settings, remove it and redeploy.
Step 4: Fix redirects in your own code
Upgrading fixes React Router’s own navigation, but if your app redirects to a destination taken from user input, such as ?returnTo= after login, your code still needs to validate it. A simple helper for a React Router action or loader:
import { redirect } from 'react-router';
export function safeRedirect(to: string | null, fallback = '/') {
if (!to || !to.startsWith('/') || to.startsWith('//') || to.startsWith('/\\')) {
return redirect(fallback);
}
return redirect(to);
}
// in a route action
export async function action({ request }: { request: Request }) {
const form = await request.formData();
// ...authenticate the user...
return safeRedirect(form.get('returnTo') as string | null, '/dashboard');
}
Only same-site paths are allowed; anything that looks like an absolute or protocol-relative URL falls back to a safe default.
Step 5: Harden against CSRF and XSS
- CSRF (GHSA-8wpx-2pj4-ggvx): per Netlify, exploitation needs plain-HTTP content on your own domain. Serve everything over HTTPS and send a
Strict-Transport-Securityheader; consider HSTS preloading so even first visits are protected. - RSC redirect XSS (GHSA-mjj8-rxh9-q8f5): only affects React Router’s experimental React Server Components modes. If you use them, upgrade and avoid redirecting to untrusted destinations.
Key takeaways
- Seven React Router advisories affect versions 6, 7 and 8; upgrade to 7.18.6 or 8.5.1.
- List installed copies with
npm ls,pnpm whyoryarn why; frameworks may pin their own copy. - React Router 6 and Remix 2 have no fix for two issues, so plan a move to v7.
- Rebuild or delete old preview deploys, and validate user-supplied redirect targets in your code.
Read Netlify’s full write-up and the React Router security advisories for details.
