React Router, XSS in ScrollRestoration (High Severity)

Listen to this Post

The vulnerability occurs in React Router’s Server-Side Rendering (SSR) when using Framework Mode with the `` component. Specifically, when the `getKey` or `storageKey` props are utilized during SSR, if untrusted content—such as user input or external data—is used to generate these keys, it can lead to Cross-Site Scripting (XSS). During SSR, React Router serializes state and keys into the HTML response sent to the client. If malicious JavaScript code is embedded in the keys via untrusted content, it may not be properly sanitized, allowing arbitrary script execution when the page is rendered on the server and sent to the browser. This happens because the keys are injected into the DOM during hydration, bypassing typical client-side XSS protections. The vulnerability is confined to SSR in Framework Mode; Declarative Mode (<BrowserRouter>) and Data Mode (createBrowserRouter or <RouterProvider>) are not affected, nor are applications with SSR disabled. Attackers could exploit this by crafting malicious keys that execute scripts during server rendering, potentially compromising user sessions or stealing data. The issue underscores the importance of validating and sanitizing all inputs used in SSR context, especially in dynamic routing scenarios.

DailyCVE Form:

Platform: React Router
Version: Framework Mode
Vulnerability: SSR XSS
Severity: High
Date: Jan 8, 2026

Prediction: Expected Patch Date: Pending

What Undercode Say:

Analytics:

bash commands and codes related to the blog

Check React Router version in project

npm list react-router-dom

Simulate SSR with vulnerable ScrollRestoration setup

node server.js

Sample code snippet showing vulnerable ScrollRestoration usage

import { ScrollRestoration } from ‘react-router-dom’;

function App() {

return untrustedContent} />;

}

How Exploit:

Attackers inject malicious scripts via untrusted content in getKey/storageKey props during SSR, leading to execution when HTML is served.

Protection from this CVE:

Disable SSR in Framework Mode, avoid untrusted content for keys, use Declarative or Data Mode, sanitize inputs.

Impact:

Arbitrary JavaScript execution, session hijacking, data theft, compromised user trust.

🎯Let’s Practice Exploiting & Learn Patching For Free:

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top