CVE-2025-59057
High · 7.6React Router has XSS Vulnerability
CVSS
7.6
EPSS
0.5%
Published
Jan 8, 2026
CISA due date
—
Cloudanix analysis
A vulnerable website could let attackers hide malicious code in page metadata so it runs in visitors’ browsers when they open the page.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Moderate
- Impact
- Remote Code Execution
- Component
- Web Framework
- Class
- XSS
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The vulnerability is a cross-site scripting flaw in React Router Framework Mode when the meta()/Meta APIs are used to generate JSON-LD script tags from untrusted data during server-side rendering. If attacker-controlled content is inserted into the generated script:ld+json output without safe escaping, the attacker can break out of the intended structured-data context and cause arbitrary JavaScript to execute in the victim’s browser under the vulnerable application’s origin. This is not server-side code execution and does not affect React Router Declarative Mode or Data Mode usage as described, but it can compromise browser sessions and application actions performed by users who view affected pages. The supplied affected-product metadata lists Debian linux packages with fixed versions, which should be validated against actual package advisories and application dependency inventories because it does not align cleanly with the React Router-specific description.
Why it matters to the business
Successful exploitation can let an attacker run malicious code in users’ browsers when they visit affected pages, leading to session theft, unauthorized actions, credential or token exposure, phishing overlays, data exfiltration from the application context, and reputational harm. Risk is highest for public-facing applications that render user-supplied content into SEO or structured-data metadata using React Router Framework Mode. The issue has a CVSS score of 7.6, low EPSS probability of 0.00448, no known CISA KEV listing, no ransomware association, and no known mature public exploitation in the provided data, so remediation should be prioritized but balanced against internet exposure and whether the vulnerable API pattern is actually present.
How an attack unfolds
An attacker first identifies an application using React Router Framework Mode with server-side rendering and pages that populate meta()/Meta JSON-LD script tags from untrusted or weakly validated content, such as profile names, product descriptions, reviews, search terms, CMS fields, or route data. The attacker submits a payload designed to terminate or corrupt the JSON-LD script context and introduce executable JavaScript, commonly by injecting closing script tags or event-handler-based HTML. When the vulnerable route is rendered, the server includes the attacker-controlled value in the generated metadata without sufficient escaping. A victim then visits the affected page, and the browser interprets the injected content as executable script in the application’s origin. The attacker’s script can read accessible page data, capture tokens not protected by HttpOnly, perform actions as the victim, redirect the user, or beacon data to attacker-controlled infrastructure.
How to fix it
Upgrade affected React Router versions once the relevant patched release is identified by the official React Router advisory and package lockfiles. If relying on the supplied Debian package metadata, validate applicability and update affected Debian packages to at least: Debian 11 linux package 5.10.113-1; Debian 12 linux package 5.17.6-1; Debian 13 linux package 5.17.6-1; Debian 14 linux package 5.17.6-1. In addition, remove untrusted input from meta()/Meta-generated JSON-LD where possible, strictly validate and encode all values before insertion, and ensure JSON serialization uses safe escaping for characters that can terminate script contexts, especially <, >, &, U+2028, and U+2029. Avoid manually concatenating JSON-LD script bodies. Use allowlists for structured-data fields, sanitize CMS/user-generated content before metadata generation, and add a Content Security Policy that blocks inline script execution where feasible using nonces or hashes. Confirm whether applications use React Router Framework Mode; applications using only BrowserRouter, createBrowserRouter, or RouterProvider as described are not affected by this specific issue.
How to confirm the fix worked
Confirm exposure by reviewing dependency manifests, lockfiles, and runtime bundles for React Router Framework Mode usage and by searching source code for meta(), Meta, script:ld+json, application/ld+json, and server-side rendered route metadata that includes user-controlled data. Verify patched package versions through npm/yarn/pnpm lockfiles and software composition analysis, and separately verify Debian package versions only if those advisories are applicable to the deployed systems. Test representative pages by injecting benign XSS canaries into fields that feed metadata and inspecting the server-rendered HTML to ensure the value remains safely encoded inside JSON-LD and cannot close the script tag. After remediation, browser-based tests should confirm that payloads such as closing script tags and event handlers render inertly and no unexpected script execution occurs. Validate CSP in report-only and enforcement mode to ensure inline script injection would be blocked without breaking legitimate functionality.
Typical attack path
- Find a public route rendered with React Router Framework Mode and server-side rendering.
- Identify fields that influence meta()/Meta output, especially JSON-LD structured-data fields.
- Submit or store crafted content containing script-breaking or HTML/JavaScript payloads.
- Wait for the vulnerable page to be rendered by the server and viewed by another user.
- Execute JavaScript in the victim browser under the trusted application origin.
- Steal accessible session data, perform unauthorized actions, redirect users, or exfiltrate application data.
How to detect it
To determine whether exploitation already occurred, review web server, CDN, WAF, reverse proxy, and application logs for requests that submit or retrieve suspicious metadata values containing script-breaking sequences, HTML event handlers, JavaScript URLs, or exfiltration functions. Focus on endpoints that create or edit content later rendered into SEO metadata or JSON-LD, including CMS publishing, profile editing, product catalog, review, comment, search, and route-data APIs. Inspect server-rendered HTML snapshots, cache entries, CDN cached objects, and application error logs for unexpected closing script tags inside application/ld+json or script:ld+json blocks. Browser telemetry, CSP violation reports, RUM data, and EDR browser-child-process/network events can reveal injected scripts beaconing to unfamiliar domains. If suspicious payloads are found, correlate the submitting account or source IP with subsequent victim page views, unusual authenticated actions, session reuse, token refreshes, redirects, or outbound requests to attacker-controlled infrastructure. There are no named threat actors or KEV exploitation signals in the provided data, so detection should focus on payload artifacts and application-specific data flow rather than actor-specific infrastructure.
- </script><script
- </script><img
- </script><svg
- script:ld+json
- application/ld+json
- onerror=
- onload=
- javascript:
- document.cookie
- localStorage
- sessionStorage
- navigator.sendBeacon
- fetch(
- XMLHttpRequest
- eval(
- atob(
- <Meta
- meta()
What your security team should do
- Inventory applications using React Router Framework Mode with server-side rendering and prioritize internet-facing or authenticated high-value applications.
- Search code for meta()/Meta JSON-LD generation paths that consume route data, CMS content, profile data, product data, reviews, or other untrusted fields.
- Patch React Router according to the official advisory and update package lockfiles; validate Debian fixed versions only where the listed Debian linux packages are truly in scope.
- Add regression tests that inject script-breaking payloads into all metadata-producing fields and fail builds if executable HTML or JavaScript appears in rendered output.
- Deploy or strengthen Content Security Policy with nonces or hashes and minimize unsafe-inline exceptions.
- Review recent web, CDN, WAF, and application logs for XSS payloads targeting structured-data or metadata fields.
- Treat evidence of exploitation as potential account compromise: rotate exposed tokens, invalidate sessions where appropriate, and investigate unauthorized user actions.
The record
A XSS vulnerability exists in in React Router's `meta()`/`<Meta>` APIs in [Framework Mode](https://reactrouter.com/start/modes#framework) when generating `script:ld+json` tags which could allow arbitrary JavaScript execution during SSR if untrusted content is used to generate the tag. > [!NOTE] > This does not impact applications using [Declarative Mode](https://reactrouter.com/start/modes#declarative) (`<BrowserRouter>`) or [Data Mode](https://reactrouter.com/start/modes#data) (`createBrowserRouter`/`<RouterProvider>`).
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| npm | @remix-run/react | 1.15.0 | 2.17.1 |
| npm | react-router | 7.0.0 | 7.9.0 |
Related vulnerabilities
- GHSA-3cgp-3xvw-98x8 React Router has XSS Vulnerability Same vulnerability
- GHSA-8v8x-cx79-35w7 React Router SSR XSS in ScrollRestoration Also affects @remix-run/react
- CVE-2026-21884 React Router SSR XSS in ScrollRestoration Also affects @remix-run/react
- CVE-2026-53663 React Router is a router for React. Also affects react-router
- GHSA-84g9-w2xq-vcv6 React Router: Potential CSRF via PUT/PATCH/DELETE document requests Also affects react-router
- GHSA-rxv8-25v2-qmq8 React Router vulnerable to Denial of Service via reflected user input in single-fetch Also affects react-router
- GHSA-8x6r-g9mw-2r78 React Router vulnerable to DoS via unbounded path expansion in __manifest endpoint Also affects react-router
- GHSA-49rj-9fvp-4h2h React Router's vendored turbo-stream v2 allows arbitrary constructor invocation via… Also affects react-router