/

CVE-2026-33245

Severity:

HIGH RISK

(8.0)

Client-Side Cross-Site Scripting (CWE-79) in React Router RSC Redirect Handling

CVE-2026-33245

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Client-Side Code Execution / Session Compromise

Severity:

HIGH RISK

(8.0)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

React Router versions 7.7.0 through 7.13.1 contain a client-side Cross-Site Scripting (XSS) issue in the handling of redirects when using the unstable React Server Components (RSC) APIs.

If an application accepts redirects from untrusted sources and passes them into the RSC redirect handling flow, an attacker may be able to inject and execute arbitrary JavaScript in the victim's browser.

Affected context

This vulnerability occurs only in React applications that:

  • Use React Router versions 7.7.0 through 7.13.1, and
  • Opt into React Router's unstable React Server Components (RSC) APIs, and
  • Accept or propagate redirect destinations or metadata from untrusted or partially trusted sources (e.g., query parameters, external services, or user-controlled inputs).

Applications that do not use the unstable RSC APIs are not directly affected by this specific issue, although they may still be exposed to general XSS risks if they mishandle untrusted data elsewhere.

Exploit preconditions

  • Attack surface: Browser-based clients using React Router's RSC integration.
  • Required access: Ability to influence redirect-related data flowing into the RSC redirect handling (e.g., redirect URLs, targets, or messages) via user input, query parameters, or external service responses.
  • Trigger point: The RSC redirect logic processes untrusted redirect information and reflects or injects it into client-side-rendered content or navigation flows without adequate sanitization or encoding.
  • Why exploitation is possible: The redirect handling trusts redirect data within the RSC pipeline and treats it in a way that allows script-capable content or unsafe HTML to be interpreted by the browser rather than safely encoded as inert text.

Why this happens

The underlying bug is a client-side Cross-Site Scripting issue where untrusted data associated with redirects is processed in the RSC redirect handling path without consistent output encoding or contextual escaping.

In the context of React Router's unstable RSC APIs:

  • Redirect information originating from untrusted sources can be propagated into the client-side navigation or rendering layer.
  • The redirect data is handled in a way that the browser can interpret it as executable script or HTML rather than as plain text.

This maps to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting), where user-controlled input is incorporated into a web page (or a navigation/redirect flow affecting the DOM) without proper sanitization, escaping, or validation appropriate to the browser context.

Potential impact

  • Execution of attacker-controlled JavaScript in the victim's browser.
  • Theft or misuse of session tokens, JWTs, or other authentication artifacts accessible to JavaScript.
  • Exfiltration of sensitive data from the affected application's pages (e.g., personal information, CSRF tokens, API responses).
  • Unauthorized actions performed on behalf of the victim within the application (e.g., changing account settings, initiating transactions) subject to the victim's privileges.
  • Defacement of client-side content or injection of misleading UI elements (e.g., phishing prompts, fake login dialogs).

General mitigation guidance

Effective mitigation focuses on treating all redirect-related data as untrusted and ensuring that untrusted values cannot influence client-side script execution or HTML interpretation:

  • Restrict redirect sources:
  • Accept redirect targets and metadata only from vetted, trusted components or allowlists (e.g., a fixed set of internal routes).
  • Avoid passing through redirect URLs or messages directly from user input, query parameters, or third-party services without validation.
  • Validate and normalize redirect data:
  • Validate redirect URLs against a strict pattern or allowlist (e.g., internal path-only redirects like /dashboard, not arbitrary full URLs).
  • Reject or strip any data that contains characters or constructs that can break out of expected values (e.g., <, >, javascript:, data URIs) when used within navigation or display contexts.
  • Apply proper output encoding:
  • Ensure that any redirect-related text rendered into the DOM (e.g., status messages, error details, or redirect notices) is encoded by React as plain text, not inserted through mechanisms that bypass React's built-in escaping (e.g., avoid dangerouslySetInnerHTML for such content).
  • When dynamic values must be used in URLs or attributes, perform context-appropriate encoding (e.g., URL encoding).
  • Harden overall client-side security posture:
  • Adopt a strict Content Security Policy (CSP) that disallows inline scripts and restricts script sources to trusted origins, reducing the impact of XSS if it occurs.
  • Minimize use of APIs or patterns that render raw HTML, especially in redirect-related UI.

These patterns help reduce the risk not only for this specific RSC redirect issue but also for similar XSS classes in complex client-side routing and server-components integrations.

How teams detect issues like this

To detect and monitor for this class of vulnerability, organizations can use a combination of static review and dynamic testing:

  • Static analysis & code scanning:
  • Configure linters or SAST tools to flag:
  • Use of redirect targets derived from location.search, location.hash, cookies, or unvalidated API responses within RSC-related code paths.
  • Uses of dangerouslySetInnerHTML, raw HTML insertion, or string concatenation into JSX that involve redirect or navigation data.
  • Review places where React Router's RSC APIs and redirect utilities are used, checking that redirect destinations and messages are validated and not directly derived from untrusted input.
  • Code review practices:
  • During peer review, require explicit scrutiny of:
  • Any new or modified redirect logic, particularly where inputs come from user-controlled sources.
  • Integrations between fetchers/loaders, server components, and client navigation that pass around URLs or redirect-related metadata.
  • Use a checklist for SPA and RSC features covering "untrusted input → navigation/URL/DOM" flows.
  • Dynamic and runtime testing:
  • Perform manual and automated XSS tests targeting redirect flows (e.g., fuzzing query parameters or response-driven redirects to see if payloads are reflected).
  • Monitor logs and client-side error reporting tools for suspicious script execution errors or anomalies in redirects.
  • Policy enforcement:
  • Enforce CI policies that block merges if high-risk patterns (unsafe HTML rendering, unchecked redirect usage) are detected by automated tools.

Sources

SourceLink
github.comgithub.com/remix-run/react-router/security/advisories/GHSA-8646-j5j9-6r62

Frequently asked

questions

Yes. If an application using the unstable React Router RSC APIs accepts redirect data from untrusted sources (such as query parameters, external services, or user-controlled inputs) and passes it into the vulnerable redirect handling path, an attacker can craft links or requests that trigger XSS in a victim's browser.

The attacker does not need authenticated access to the application in many scenarios. They primarily need the ability to control or influence redirect-related values that the application uses in the RSC redirect handling—for example, by getting a victim to visit a specially crafted URL or by injecting data into an upstream service that the application trusts.

Limit redirect behavior to a well-defined set of trusted destinations, validate all redirect inputs against strict rules, and ensure that no redirect-related data is ever rendered as raw HTML or used in a way that could lead to script execution in the browser. Additionally, use React's default escaping semantics and avoid bypass mechanisms (dangerouslySetInnerHTML) for any values derived from redirects.

Design redirect and navigation flows under a "zero trust" assumption for any externally influenced data: validate and normalize URLs, encode values based on their output context, and keep redirect logic centralized with clear input contracts. Complement this with security-focused code review, automated XSS-oriented testing around routing, and defensive browser controls such as a strong Content Security Policy to limit the impact of any unforeseen injection points.

Find out what's already
exploitable in your codebase.