Packages / react-router / Security
React Router has stored XSS via unescaped Location header in prerendered redirect HTML
Affected releases · react-router
- 7.x7.5.1 – 7.13.1Fixed in 7.13.2
On 7.x, the newest line:
npm install react-router@7.13.2Not affected
8.0.0 – 8.5.0
8 releases, latest
Not affected
7.0.0 – 7.5.0
14 releases
Affected
7.5.1 – 7.13.1
25 releases
Fixed
7.13.2 – 7.18.4
13 releases
Is your project affected?
Paste your package.json, or type the range you declare for react-router. It is read in your browser and sent nowhere.
What happens
When using React Router v7 Framework Mode with Pre-rendering enabled, an improper neutralization of the HTTP Location header value can permit Cross-Site Scripting (XSS) in statically generated HTML files if the redirect location comes from an untrusted source.
[!NOTE] This does not impact your React Router application if you are using Declarative Mode (
<BrowserRouter>) or Data Mode (createBrowserRouter/<RouterProvider>).