CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-139994

CVE-2026-139994: Cross-Site Scripting via Context-Mismatched HTML Escaping in React Router RSC Streaming Redirects

Alon Barad
Alon Barad
Software Engineer

Dec 1, 2026·11 min read·2 visits

Executive Summary (TL;DR)

React Router's unstable RSC Data and Framework modes fail to encode double-quote characters when rendering streaming redirects inside <meta http-equiv="refresh"> tags. Applications that incorporate user-controlled input into redirect destinations are vulnerable to reflected Cross-Site Scripting (XSS). Upgrade to React Router 7.18.4 or 8.4.0 to resolve the issue.

CVE-2026-139994 (GHSA-mjj8-rxh9-q8f5) is a Cross-Site Scripting (XSS) vulnerability in React Router affecting versions 7.11.0 through 7.18.3 and 8.0.0 through 8.3.1. The flaw resides in the server-side streaming handler for the unstable React Server Components (RSC) Data mode and RSC Framework mode. When a server-side redirect is triggered during an HTML stream, the framework injects an inline <meta http-equiv="refresh"> element into the response stream. Because the redirect destination URL is sanitized using an HTML body escaping utility (escapeHtml) rather than an attribute-specific encoding function, double-quote characters (") are left unescaped. An attacker who can influence the redirect URL can break out of the content attribute context, inject arbitrary attributes or HTML elements, and execute arbitrary JavaScript within the victim's browser session.

Vulnerability Overview

React Router is a widely deployed routing library and full-stack framework for React applications. Starting in version 7.11.0 and continuing into the 8.x release line, React Router introduced unstable support for React Server Components (RSC) via two primary architectures: RSC Data mode and RSC Framework mode. These modes allow applications to stream server-rendered UI components and data payloads directly to the client over an active HTTP connection.

In standard HTTP request-response lifecycles, server-side redirects are handled by returning an HTTP 3xx status code alongside a Location response header before any response body is transmitted. However, during server-side rendering (SSR) streaming in RSC architectures, the HTTP response headers (typically 200 OK with Transfer-Encoding: chunked) have already been flushed to the client before a dynamic route component or data loader throws or returns a redirect instruction. To execute a redirect after the stream has initialized, React Router falls back to enqueuing an HTML <meta http-equiv="refresh"> tag directly into the active response stream.

CVE-2026-139994 (also tracked as GHSA-mjj8-rxh9-q8f5) is a Cross-Site Scripting (XSS) vulnerability classified under CWE-79 and CWE-838 (Inappropriate Encoding for Output Context). The vulnerability occurs in packages/react-router/lib/rsc/server.ssr.tsx during the construction of this fallback <meta> tag. When interpolating the target redirect URL (renderRedirect.location or retryRedirect.location) into the double-quoted content attribute of the <meta> tag, the framework utilized the escapeHtml() helper function.

Because escapeHtml() was specifically designed to sanitize strings for serialization within HTML text nodes and <script> blocks rather than HTML attribute contexts, it failed to encode double-quote characters ("). Consequently, if an application passes user-controlled input into a redirect destination during an RSC streaming response, an attacker can include a double quote to break out of the content attribute boundary, inject malicious HTML or JavaScript handlers, and achieve arbitrary script execution in the security context of the victim's browser session.

Root Cause Analysis

The root cause of CVE-2026-139994 is a context mismatch between the sanitization routine applied to untrusted data and the HTML parser context in which that data is rendered. According to the HTML5 specification, the characters required to break out of a data context vary depending on whether the parser is currently in the Data state (standard HTML body text), the Script data state, or the Attribute value (double-quoted) state.

In React Router, the utility function escapeHtml() in packages/react-router/lib/dom/ssr/markup.ts was originally implemented to safely serialize state data into the DOM body and inline script tags. The implementation uses the regular expression /[&><\u2028\u2029]/g to replace ampersands (&), greater-than signs (>), less-than signs (<), and Unicode line/paragraph separators (\u2028, \u2029). While this character set is sufficient to prevent tag creation (< and >) in an HTML body context and line-termination errors in JavaScript strings, it explicitly omits quotation marks (" and ').

When routeRSCServerRequest() in packages/react-router/lib/rsc/server.ssr.tsx encounters a redirect error digest during the initial render stream (renderRedirect) or during a retry sequence (retryRedirect), it encodes the raw HTML string into a Uint8Array via TextEncoder and enqueues it onto the ReadableStreamDefaultController. The exact template string used is:

<meta http-equiv="refresh" content="0;url=${escapeHtml(renderRedirect.location)}"/>

When the client browser's HTML tokenizer parses <meta http-equiv="refresh" content="0;url=, it enters the Attribute value (double-quoted) state. In this state, the tokenizer continues consuming characters as part of the content attribute value until it encounters a literal U+0022 QUOTATION MARK ("). Because escapeHtml() leaves U+0022 intact, any double quote present in renderRedirect.location immediately transitions the tokenizer to the After attribute value (quoted) state.

> [!NOTE] > Although escapeHtml() encodes < and > into &lt; and &gt;—which prevents an attacker from closing the <meta> tag with > and opening a <script> tag—breaking out of the double-quoted attribute still permits the injection of arbitrary HTML attributes onto the <meta> tag itself, or the manipulation of subsequent attribute parsing depending on the surrounding DOM structure and browser behaviors.

Code Analysis

The vulnerability and its corresponding remediation span two files inside the packages/react-router package: lib/dom/ssr/markup.ts and lib/rsc/server.ssr.tsx. Examining the code before and after the patch illustrates the exact sanitization defect and how attribute encoding resolves it.

Prior to the patch, packages/react-router/lib/dom/ssr/markup.ts exported only escapeHtml():

// Vulnerable implementation in packages/react-router/lib/dom/ssr/markup.ts
const ESCAPE_LOOKUP: { [match: string]: string } = {
  "&": "\\u0026",
  ">": "\\u003e",
  "<": "\\u003c",
  "\u2028": "\\u2028",
  "\u2029": "\\u2029",
};
 
const ESCAPE_REGEX = /[&><\u2028\u2029]/g;
 
export function escapeHtml(html: string) {
  return html.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
}

Notice that escapeHtml() replaces &, >, and < with JavaScript Unicode escape sequences (\u0026, \u003e, \u003c) rather than HTML character entity references (&amp;, &gt;, &lt;). This confirms that escapeHtml() was originally engineered to sanitize JSON payloads embedded inside <script> tags rather than standard HTML markup attributes.

In commits c58d7152420614d6879db851aa1c74f826ddd573 (v8 branch) and e0c6b5bce96f249a71b1fc395000c6b2742c57d7 (v7 branch), the maintainers introduced a dedicated escapeAttribute() function in packages/react-router/lib/dom/ssr/markup.ts and updated both redirect streaming paths in packages/react-router/lib/rsc/server.ssr.tsx:

--- a/packages/react-router/lib/dom/ssr/markup.ts
+++ b/packages/react-router/lib/dom/ssr/markup.ts
@@ -17,3 +17,11 @@ const ESCAPE_REGEX = /[&><\u2028\u2029]/g;
 export function escapeHtml(html: string) {
   return html.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
 }
+
+// Added to safely encode values placed inside double-quoted HTML attributes
+export function escapeAttribute(value: string) {
+  return value
+    .replace(/&/g, "&amp;")
+    .replace(/"/g, "&quot;")
+    .replace(/</g, "&lt;")
+    .replace(/>/g, "&gt;");
+}
--- a/packages/react-router/lib/rsc/server.ssr.tsx
+++ b/packages/react-router/lib/rsc/server.ssr.tsx
@@ -19,7 +19,7 @@ import {
   decodeRedirectErrorDigest,
   decodeRouteErrorResponseDigest,
 } from "../errors";
-import { escapeHtml } from "../dom/ssr/markup";
+import { escapeAttribute } from "../dom/ssr/markup";
 
 const defaultManifestPath = "/__manifest";
 
@@ -282,7 +282,7 @@ export async function routeRSCServerRequest({
 
           controller.enqueue(
             new TextEncoder().encode(
-              `<meta http-equiv="refresh" content="0;url=${escapeHtml(renderRedirect.location)}"/>`,
+              `<meta http-equiv="refresh" content="0;url=${escapeAttribute(renderRedirect.location)}"/>`,
             ),
           );
         }
@@ -428,7 +428,7 @@ export async function routeRSCServerRequest({
 
             controller.enqueue(
               new TextEncoder().encode(
-                `<meta http-equiv="refresh" content="0;url=${escapeHtml(retryRedirect.location)}"/>`,
+                `<meta http-equiv="refresh" content="0;url=${escapeAttribute(retryRedirect.location)}"/>`,
               ),
             );
           }

Fix Completeness Assessment

The introduction of escapeAttribute() properly converts & to &amp;, " to &quot;, < to &lt;, and > to &gt;. Because the HTML parser does not interpret &quot; as an attribute delimiter when scanning inside a double-quoted attribute value, it is no longer possible to break out of the content="..." boundary in either renderRedirect or retryRedirect.

Two residual characteristics of the patch warrant consideration by developers:

  1. Single Quotes: escapeAttribute() does not encode single quotes (' to &#39; or &apos;). Within server.ssr.tsx, the <meta> tag attributes are strictly delimited by double quotes, so the absence of single-quote encoding does not render this call site vulnerable. However, if escapeAttribute() is reused elsewhere in the codebase inside a single-quoted attribute template (attr='${escapeAttribute(val)}'), attribute breakout would be possible.
  2. URL Scheme Validation: Because escapeHtml() previously replaced &, <, and > with literal backslash-u strings (\u0026), query parameters containing & in redirect URLs were previously corrupted in <meta> tags, whereas escapeAttribute() properly preserves them as &amp;. However, escapeAttribute() only enforces structural attribute containment; it does not validate the URL scheme inside 0;url=.... If an application passes an unvalidated, user-supplied string directly to a redirect helper without checking that it is a relative path or http:/https: URL, an attacker could supply a javascript: or data: URI inside the <meta http-equiv="refresh"> payload.

Exploitation

Exploiting CVE-2026-139994 requires a target application to satisfy three specific prerequisites:

  1. The application runs an affected version of React Router (>= 7.11.0, < 7.18.4 or >= 8.0.0, < 8.4.0).
  2. The application is configured to use the unstable RSC Data mode or RSC Framework mode.
  3. A route component or server function triggers a streaming SSR redirect (renderRedirect or retryRedirect) whose target location string incorporates attacker-controlled input (for example, from query parameters like ?returnTo=, ?next=, or dynamic route segments).

There are two primary exploitation vectors depending on how the application constructs the redirect target:

Vector 1: HTML Attribute Injection via Double-Quote Breakout

In the Vulnerable code, escapeHtml() transforms < into \u003c and > into \u003e, which prevents an attacker from closing the <meta> tag with a literal > and injecting a new <script> element. However, because " is not encoded, an attacker can terminate the content attribute and inject additional attributes directly into the <meta> element.

If an attacker supplies a payload in a reflected redirect parameter such as:

https://example.com/auth/check?returnTo=/dashboard"%20onanimationstart="alert(document.domain)"%20style="animation-name:x

During RSC streaming, routeRSCServerRequest() generates and streams the following markup:

<meta http-equiv="refresh" content="0;url=/dashboard" onanimationstart="alert(document.domain)" style="animation-name:x"/>

If the page already defines a CSS @keyframes x animation (or any existing keyframe animation name present in the application's stylesheet, such as Tailwind's spin, ping, pulse, or bounce), attaching style="animation-name:spin;animation-duration:0.01s" alongside onanimationstart or onanimationend on the <meta> tag triggers immediate JavaScript execution in modern browsers without requiring user interaction beyond visiting the link. Similarly, injecting id, name, or data-* attributes onto the <meta> tag can be leveraged for DOM Clobbering attacks against client-side scripts.

Vector 2: Protocol Handler Execution via Meta Refresh

Furthermore, if the application allows arbitrary strings at the start of the redirect target (an open redirect condition) or if an attacker uses the url= directive parsing quirks of <meta http-equiv="refresh">, breaking out of or manipulating the content attribute allows overriding the refresh directive itself. Even without breaking out of the double quote, if an attacker can control the prefix of renderRedirect.location (e.g., ?returnTo=javascript:alert(document.domain)), the browser will process:

<meta http-equiv="refresh" content="0;url=javascript:alert(document.domain)"/>

When the refresh timer (0 seconds) fires, browsers that permit javascript: execution in meta-refresh contexts or specific embedded webviews will execute the payload in the current origin's context.

Impact Assessment

The vulnerability carries a CVSS v3.1 base score of 4.7 (Medium) with the vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:L/A:N.

  • Attack Vector (AV:N) & Attack Complexity (AC:L): The vulnerability is remotely exploitable over standard HTTP/HTTPS connections without requiring special timing or race conditions once an eligible redirect endpoint exists.
  • Privileges Required (PR:N) & User Interaction (UI:R): No authentication is required to craft the malicious URL, though a victim user must be induced to navigate to the crafted link (typical of reflected XSS).
  • Scope (S:C): The vulnerability occurs within the server-side router rendering component, while the resulting script execution runs within the client browser's security origin, crossing a security boundary.
  • Impact (C:N/I:L/A:N): The official CNA scoring rates Integrity impact as Low (I:L) and Confidentiality impact as None (C:N), reflecting constrained DOM modification within the specific redirect flow.

In practical deployment scenarios, if arbitrary JavaScript execution is achieved within the application's origin prior to navigation, the attacker gains the ability to read non-HttpOnly session cookies, extract sensitive tokens from localStorage or sessionStorage, read the current DOM state, or issue authenticated fetch()/XMLHttpRequest calls to backend APIs on behalf of the victim user.

The scope of affected installations is naturally constrained by the fact that React Server Components (RSC) Data mode and RSC Framework mode are designated as unstable features in React Router v7 and v8. Applications using standard React Router client-side routing, standard SSR framework mode (non-RSC), or standard HTTP 3xx header redirects are not affected by this code path.

Remediation & Mitigation

To remediate CVE-2026-139994, organizations utilizing React Router's unstable RSC modes should upgrade to the patched releases immediately.

Official Patch Upgrades

  • React Router v7.x Users: Upgrade react-router and all aligned @react-router/* packages to version 7.18.4 or later.
  • React Router v8.x Users: Upgrade react-router and all aligned @react-router/* packages to version 8.4.0 or later.
# For v7.x installations
npm install react-router@^7.18.4
 
# For v8.x installations
npm install react-router@^8.4.0

Defense-in-Depth & Workarounds

If an immediate framework upgrade is not feasible, or to harden applications against both XSS and Open Redirect vulnerabilities even after patching, implement the following controls:

  1. Strict Redirect Target Validation: Never pass raw user-controlled query parameters or form fields directly into redirect() calls. Validate that all dynamic redirect targets are strictly local relative paths that start with a single forward slash (/) and do not start with // or \, and reject or strip any URL containing double quotes ("), whitespace, or control characters:
function getSafeRedirectUrl(target: string | null, fallback = "/"): string {
  if (!target || typeof target !== "string") return fallback;
  // Ensure target starts with a single '/' and contains no quotes or protocol schemes
  if (!target.startsWith("/") || target.startsWith("//") || target.startsWith("/\\")) {
    return fallback;
  }
  if (target.includes('"') || target.includes("'") || /[\r\n\t]/.test(target)) {
    return fallback;
  }
  return target;
}
  1. Content Security Policy (CSP): Deploy a strict Content Security Policy header that disables unsafe inline script execution (omitting 'unsafe-inline' from script-src and using cryptographic nonces or hashes). When inline event handlers like onanimationstart are injected via attribute breakout, a nonce-based or strict script-src policy instructs the browser to block the execution of the inline event handler.

Official Patches

GitHub / Remix SoftwareOfficial GitHub Security Advisory (GHSA-mjj8-rxh9-q8f5)
GitHub / Remix SoftwareReact Router v7.18.4 Release Notes
GitHub / Remix SoftwareReact Router v8.4.0 Release Notes

Fix Analysis (2)

Technical Appendix

CVSS Score
4.7/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:L/A:N

Affected Systems

react-routercreate-react-router@react-router/dev@react-router/node@react-router/serve@react-router/express@react-router/cloudflare@react-router/architect@react-router/fs-routes@react-router/remix-routes-option-adapter

Affected Versions Detail

Product
Affected Versions
Fixed Version
react-router
Remix Software / Shopify
>= 7.11.0, < 7.18.47.18.4
react-router
Remix Software / Shopify
>= 8.0.0, < 8.4.08.4.0
AttributeDetail
Vulnerability TypeCross-Site Scripting (CWE-79 / CWE-838)
Affected ComponentReact Router Unstable RSC Data & Framework Modes (server.ssr.tsx)
CVSS v3.1 Score4.7 Medium (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:L/A:N)
Attack VectorNetwork (Reflected via Attacker-Controlled Redirect Target)
Affected Versions>= 7.11.0, < 7.18.4 and >= 8.0.0, < 8.4.0
Patched Versions7.18.4 and 8.4.0
Exploit StatusNo known public exploits in the wild
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1189Drive-by Compromise
Initial Access
T1185Browser Session Hijacking
Collection
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. Furthermore, it maps to CWE-838 (Inappropriate Encoding for Output Context) due to the application of an HTML body encoding routine within a double-quoted HTML attribute value.

Vulnerability Timeline

Fix commits c58d7152420614d6879db851aa1c74f826ddd573 and e0c6b5bce96f249a71b1fc395000c6b2742c57d7 merged in PRs #15491 and #15492
2026-09-11
GitHub Security Advisory GHSA-mjj8-rxh9-q8f5 and CVE-2026-139994 officially published
2026-11-30
NVD indexes CVE-2026-139994 with CVSS v3.1 base score of 4.7
2026-11-30

References & Sources

  • [1]CVE-2026-139994 Official CVE Record
  • [2]NVD Vulnerability Detail: CVE-2026-139994
  • [3]GitHub Security Advisory: GHSA-mjj8-rxh9-q8f5
  • [4]React Router Pull Request #15491
  • [5]React Router Pull Request #15492
  • [6]Fix Commit c58d7152420614d6879db851aa1c74f826ddd573 (main)
  • [7]Fix Commit e0c6b5bce96f249a71b1fc395000c6b2742c57d7 (v7 branch)
  • [8]React Router v7.18.4 Release Notes
  • [9]React Router v8.4.0 Release Notes
  • [10]React Router v7 Changelog (v7.18.4)
  • [11]React Router v8 Changelog (v8.4.0)

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 2 hours ago•CVE-2026-139996
7.4

CVE-2026-139996: Prototype Pollution in React Router via Vendored turbo-stream Deserializer

CVE-2026-139996 is a prototype pollution vulnerability (CWE-1321) in React Router's vendored turbo-stream deserializer, utilized in Framework mode for single-fetch transitions and client-server hydration. When unflattening serialized streams, the decoder assigns object properties using direct bracket notation (object[key] = value) rather than defining own properties via Object.defineProperty. Furthermore, the deserializer lacks integer and bounds validation on stream reference indices. An attacker capable of supplying crafted turbo-stream payloads to the deserializer can pollute Object.prototype or trigger arbitrary index dereferences, compromising application integrity and confidentiality.

Amit Schendel
Amit Schendel
2 views•9 min read
•about 3 hours ago•CVE-2026-137181
7.1

CVE-2026-137181: Incorrect Authorization via Improper Context Cancellation Propagation in OpenFGA

CVE-2026-137181 (GHSA-637h-v79h-mvqf) is an incorrect authorization vulnerability (CWE-863) in OpenFGA versions 1.10.3 through 1.22.x. The graph evaluation engine fails to distinguish between normal stream exhaustion and context cancellations or deadline exceedances during concurrent set evaluations. When resolving models using relational set operations (and, or, but not), an aborted worker branch can be evaluated as empty rather than errored, causing the engine to return unauthorized access grants (Allowed: true). When query caching is enabled, these erroneous evaluation states can be persisted to the in-memory cache, poisoning subsequent authorization checks.

Amit Schendel
Amit Schendel
3 views•9 min read
•about 4 hours ago•CVE-2026-137200
7.5

CVE-2026-137200: Denial of Service via Unhandled Upgrade Error in Engine.IO

An uncaught exception vulnerability (CWE-248) in Engine.IO versions prior to 6.6.12 allows remote unauthenticated attackers to cause a Denial of Service (DoS) against Node.js applications utilizing Engine.IO or Socket.IO. By sending an HTTP upgrade request targeting a non-Engine.IO URL path and forcibly resetting the underlying TCP connection before the internal destruction timeout expires, an attacker triggers an unhandled ECONNRESET error event on the socket object, terminating the entire Node.js runtime process.

Alon Barad
Alon Barad
6 views•10 min read
•about 5 hours ago•CVE-2026-137199
9.2

CVE-2026-137199: OS Command Injection in cross-spawn on Windows via Batch File Argument Escaping Bypass

CVE-2026-137199 (GHSA-ghv9-86vm-4v8m) is a critical OS command injection vulnerability in the Node.js cross-spawn library affecting versions prior to 6.0.7 and 7.1.0 on Windows. The vulnerability stems from incomplete metacharacter escaping when routing batch scripts (.bat and .cmd) outside of node_modules/.bin through cmd.exe, alongside flaws in file extension canonicalization, environment variable expansion, and line break handling. Attackers who control arguments passed to batch scripts can break out of argument quoting and execute arbitrary system commands.

Alon Barad
Alon Barad
5 views•15 min read
•about 6 hours ago•GHSA-CX3C-RMCX-FF35
5.9

GHSA-cx3c-rmcx-ff35: Metadata Partition-Key Collisions in OpenTelemetry Collector exporterhelper

An improper data encoding vulnerability (CWE-172) exists in the OpenTelemetry Collector exporterhelper package between versions 0.147.0 and 0.163.x. When metadata-partitioned batching is enabled with multiple metadata keys, the partition key generator uses an unescaped null byte delimiter to concatenate key names and multi-valued header arrays. An authenticated attacker capable of sending multi-valued HTTP or gRPC headers to an ingress receiver can induce partition key collisions, causing cross-tenant telemetry data mixture, data poisoning, or unauthorized data exfiltration.

Alon Barad
Alon Barad
9 views•10 min read
•about 7 hours ago•CVE-2026-137187
5.4

CVE-2026-137187: Fail-Open Project Allowlist Authorization Bypass in @zereight/mcp-gitlab

CVE-2026-137187 (GHSA-5xhm-p3jx-2fmc) is a missing authorization vulnerability (CWE-862) in @zereight/mcp-gitlab affecting versions 2.2.5 through 2.3.6. The flaw exists within the gitlab_api_request tool, where project allowlist enforcement fails open when evaluating API paths that do not conform to the /projects/:id pattern or when following HTTP redirects to an empty relative path. Attackers or compromised LLM agents with access to the api toolset can bypass project isolation boundaries to query or modify group, user, and instance-level GitLab resources permitted by the server's underlying authentication token.

Alon Barad
Alon Barad
9 views•10 min read