CVE-2025-59057 Overview
A Cross-Site Scripting (XSS) vulnerability exists in React Router's meta()/<Meta> APIs when operating in Framework Mode. The vulnerability occurs during the generation of script:ld+json tags and could allow arbitrary JavaScript execution during Server-Side Rendering (SSR) if untrusted content is used to generate the tag. This affects @remix-run/react versions 1.15.0 through 2.17.0 and react-router versions 7.0.0 through 7.8.2.
Critical Impact
Attackers can execute arbitrary JavaScript code during SSR by injecting malicious content through the vulnerable meta tag generation APIs, potentially leading to session hijacking, credential theft, or malicious content delivery to end users.
Affected Products
- @remix-run/react versions 1.15.0 through 2.17.0
- react-router versions 7.0.0 through 7.8.2
- Applications using React Router Framework Mode with script:ld+json meta tag generation
Discovery Timeline
- 2026-01-10 - CVE CVE-2025-59057 published to NVD
- 2026-01-13 - Last updated in NVD database
Technical Details for CVE-2025-59057
Vulnerability Analysis
This vulnerability is classified as CWE-79 (Improper Neutralization of Input During Web Page Generation), commonly known as Cross-Site Scripting (XSS). The flaw exists specifically within React Router's meta() function and <Meta> component when used in Framework Mode to generate script:ld+json (JSON-LD) tags for structured data.
When an application incorporates untrusted user-supplied content into the script:ld+json tag generation process, the lack of proper sanitization allows attackers to break out of the JSON context and inject arbitrary JavaScript code. This code executes during Server-Side Rendering (SSR), making it particularly dangerous as it runs in a trusted server context before the page reaches the client.
Importantly, this vulnerability does not affect applications using Declarative Mode (<BrowserRouter>) or Data Mode (createBrowserRouter/<RouterProvider>). Only Framework Mode deployments that dynamically generate JSON-LD structured data with user-controlled input are vulnerable.
Root Cause
The root cause is insufficient input sanitization when generating script:ld+json tags within the meta() and <Meta> APIs. The vulnerable code path fails to properly escape or validate content that gets embedded into these script tags, allowing special characters to break out of the intended JSON context and inject executable JavaScript.
Attack Vector
The attack is network-based and requires user interaction. An attacker must craft a malicious payload and trick a victim into visiting a page where their untrusted input is processed through the vulnerable meta()/<Meta> APIs. Due to the changed scope, a successful exploit can impact resources beyond the vulnerable component, potentially affecting the user's entire session and other origin-bound data.
The exploitation mechanism involves injecting content containing script-breaking sequences (such as </script>) followed by malicious JavaScript. When the SSR engine renders the page, this injected code executes in the server context and the resulting payload is delivered to the client.
Detection Methods for CVE-2025-59057
Indicators of Compromise
- Unexpected </script> sequences or JavaScript code appearing in script:ld+json tags within rendered HTML
- Anomalous JavaScript execution patterns during SSR that weren't part of the original application code
- User reports of unexpected browser behavior or security warnings when accessing pages with dynamic meta tags
- Log entries showing malformed JSON-LD structured data with embedded script tags
Detection Strategies
- Audit application code for usage of meta() function or <Meta> component with dynamic, user-controlled content in Framework Mode
- Implement Content Security Policy (CSP) headers to restrict inline script execution and detect policy violations
- Deploy Web Application Firewall (WAF) rules to detect XSS payloads targeting JSON-LD contexts
- Review server logs for requests containing suspicious payloads with script injection patterns
Monitoring Recommendations
- Monitor CSP violation reports for attempts to execute unauthorized inline scripts
- Set up alerts for unusual patterns in structured data generation endpoints
- Implement real-time monitoring of rendered page content for script injection anomalies
- Track dependency versions across deployments to ensure vulnerable packages are identified
How to Mitigate CVE-2025-59057
Immediate Actions Required
- Update @remix-run/react to version 2.17.1 or later immediately
- Update react-router to version 7.9.0 or later immediately
- Audit all usages of meta() and <Meta> APIs to identify where user-controlled content may be processed
- Implement input validation and sanitization for any dynamic content used in meta tag generation
Patch Information
The vulnerability has been addressed in the following patched versions:
- @remix-run/react version 2.17.1
- react-router version 7.9.0
For detailed information about the security fix, refer to the GitHub Security Advisory.
Workarounds
- If immediate patching is not possible, avoid using user-controlled content in meta() or <Meta> APIs for script:ld+json generation
- Consider switching to Declarative Mode (<BrowserRouter>) or Data Mode (createBrowserRouter/<RouterProvider>) which are not affected by this vulnerability
- Implement strict server-side input validation to sanitize any content before it reaches the meta tag generation APIs
- Deploy Content Security Policy headers with strict script-src directives to mitigate the impact of potential exploitation
# Update @remix-run/react to patched version
npm update @remix-run/react@2.17.1
# Update react-router to patched version
npm update react-router@7.9.0
# Verify installed versions
npm list @remix-run/react react-router
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


