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-40181

CVE-2026-40181: Open Redirect Vulnerability in React Router

Amit Schendel
Amit Schendel
Senior Security Researcher

Jun 3, 2026·7 min read·4 visits

Executive Summary (TL;DR)

React Router fails to validate protocol-relative double-slash URLs (e.g., //attacker.com) in its redirect helper, allowing attackers to bypass internal redirect checks and route users to external malicious sites.

An open redirect vulnerability exists in the react-router library due to insufficient validation of double-slash prefix paths in the redirect programmatic navigation helper. Attackers can leverage this to bypass standard destination validation checks and redirect users to malicious domains. This occurs because browsers interpret double-slash URLs as protocol-relative targets rather than relative application paths.

Vulnerability Overview

The React Router framework is a core component for state-based client-side and server-side navigation in modern React applications. Beginning in version 6.4, React Router introduced Data Routers, which enabled powerful features like data loaders, actions, and programmatic navigation utilities such as the redirect function. This utility allows developers to return a response that instructs the router to navigate to a new path or external URL.

CVE-2026-40181 identifies an open redirect vulnerability within this redirection processing layer. The flaw arises from the way React Router evaluates and processes relative paths during programmatic navigation. When an application passes a user-controlled string that begins with double slashes (such as //attacker.com) to the redirect function, the routing engine fails to neutralize it as an external protocol-relative link.

As a consequence, the application inadvertently facilitates an open redirect. Standard input-validation checks designed by developers to ensure redirection targets are local (for example, verifying if a URL begins with a single slash /) are bypassed because a double-slash string satisfies the check but is processed by browsers as a protocol-relative external domain.

Root Cause Analysis

To understand the root cause, one must examine how modern web browsers parse and resolve relative URLs. Under the URL specification, any string that begins with two forward slashes (//) followed by a domain name is treated as a protocol-relative URL. When the browser attempts to fetch or navigate to this target, it automatically inherits the active protocol (either http: or https:) of the current origin.

React Router's internal transition system distinguishes between internal application navigation and hard external document navigation. When a loader or action returns a redirect response, the client-side router intercepts the Location header. If the path is classified as local, React Router uses its history mechanism to navigate within the single-page application context. However, if the destination is recognized as external, the application falls back to standard browser-level redirection using the window.location.assign() interface.

The core defect in React Router's architecture is the absence of verification for protocol-relative formats inside the redirect validation sequence. The library treated strings starting with two slashes as relative route paths rather than absolute external URLs. Consequently, when client-side execution processes the redirect payload or the browser processes the raw server-side 302 response, the target address is interpreted relative to the browser protocol rather than the host domain, leading directly to external redirection.

Code Analysis

An examination of the vulnerable pattern highlights how naive checking logic allows attackers to bypass security boundaries. Consider the following common logic used by developers to validate user-controlled redirect targets before passing them to the framework:

// Vulnerable Application Code Pattern
import { redirect } from "react-router";
 
export async function loader({ request }) {
  const url = new URL(request.url);
  const target = url.searchParams.get("redirectTo");
  
  // The developer attempts to restrict redirects to internal paths
  if (target && target.startsWith("/")) {
    // If target is "//attacker.com", it starts with "/" and is allowed
    return redirect(target);
  }
  return redirect("/home");
}

In the vulnerable versions of React Router, the framework's internal transition manager handles the redirect response. It extracts the location value and executes the window navigation without checking if the relative-looking path is actually a protocol-relative URL:

// Conceptual representation of vulnerable library transition handler
function handleRedirect(locationValue) {
  if (isExternalUrl(locationValue)) {
    // Safely handles absolute URLs starting with http:// or https://
    window.location.assign(locationValue);
  } else {
    // Treats "//attacker.com" as an internal path but window.location.assign()
    // will resolve it as a protocol-relative external URL
    window.location.assign(locationValue);
  }
}

The official patch addresses this issue by updating the internal path-parsing and validation utilities within React Router. The framework now explicitly identifies and rejects or sanitizes strings starting with double slashes (//) or backslashes (/\\) during redirect resolution. This prevents the browser from treating a client-side navigation state as an external origin transition.

Exploitation Mechanics

Exploiting this vulnerability does not require authenticated status or specialized execution privileges. The attacker must first locate an application route that exposes a query parameter or form field which is dynamically parsed and supplied to the React Router redirect utility. Common targets include login redirection parameters, post-action feedback flows, or locale-switching links.

The attacker constructs a link containing a double-slash payload targeting a malicious external domain. For example: https://trusted-app.com/login?next=//malicious-domain.com/phish-page

When the victim clicks the link and performs the action (e.g., successful authentication), the backend loader or action extracts the next value. Because the string begins with a slash, it bypasses basic checks and is passed to redirect("//malicious-domain.com/phish-page"). The server returns an HTTP 302 with Location: //malicious-domain.com/phish-page, or the client-side single-page app framework transitions via window.location.assign("//malicious-domain.com/phish-page"). The browser resolves this protocol-relative destination and loads the malicious site.

Impact Assessment

While open redirect vulnerabilities do not directly compromise server-side assets or database confidentiality, their impact on user-session integrity and brand reputation is substantial. They are primary mechanisms used in spearphishing campaigns to bypass spam filters and security boundaries. Because the initial URL points to a legitimate, trusted domain, security gateways and users are highly likely to trust the link.

Once the browser processes the protocol-relative transition, the victim is transferred to an external domain under the attacker's absolute control. Attackers commonly construct realistic phishing templates that mimic the host application's login UI, tricking users into re-authenticating and yielding their credentials or session tokens.

In React Router applications that leverage server-side rendering (SSR), this vulnerability also allows attackers to manipulate response headers. This can interfere with intermediate caching proxies or Content Delivery Networks (CDNs), which might cache the 302 redirect response with the malicious target location, impacting subsequent visitors of the legitimate route.

Remediation and Mitigation

The primary remedy for CVE-2026-40181 is to upgrade the react-router and react-router-dom packages to secure releases. For projects using the v6 release branch, upgrade to version 6.30.4 or higher. For teams utilizing the v7 framework layer (including newer Remix applications), deploy version 7.14.1 or newer.

If immediate library upgrades are restricted due to release freezes or compatibility conflicts, developers must implement robust manual validation on all redirection values. Naive checks using .startsWith("/") must be replaced with strict validation logic that explicitly denies double slashes and backslashes.

// Recommended mitigation helper
export function safeRedirect(url: string | null, fallback: string = "/"): Response {
  if (!url) {
    return redirect(fallback);
  }
  
  // Validate that path is relative and does not contain protocol-relative formats
  const isRelative = url.startsWith("/") && !url.startsWith("//") && !url.startsWith("/\\");
  
  if (isRelative) {
    return redirect(url);
  }
  
  return redirect(fallback);
}

Additionally, deploying a Content Security Policy (CSP) with a restricted form-action and auditing any DOM navigation vectors provides defense-in-depth, minimizing the risk of unauthorized external redirections across the organization's web applications.

Technical Appendix

CVSS Score
6.6/ 10
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:U
EPSS Probability
0.04%
Top 87% most exploited

Affected Systems

react-routerreact-router-domRemix Framework (via React Router core library)
AttributeDetail
CWE IDCWE-601 (URL Redirection to Untrusted Site)
Attack VectorNetwork (AV:N)
CVSS Score6.6
EPSS Score0.00041
ImpactHigh Integrity Impact (External Redirection Phishing)
Exploit StatusUnproven (No active public exploits)
KEV StatusNot Listed
CWE-601
URL Redirection to Untrusted Site ('Open Redirect')

Vulnerability Timeline

Vulnerability Disclosed & Patch Released
2026-02-18

References & Sources

  • [1]GitHub Security Advisory GHSA-2j2x-hqr9-3h42
  • [2]NVD Vulnerability Details for CVE-2026-40181
  • [3]React Router Project Repository

More Reports

•9 minutes ago•GHSA-F9RX-7WF7-JR36
8.1

GHSA-F9RX-7WF7-JR36: Two-Factor Authentication Bypass and Passwordless API Key Creation in Froxlor

An architectural flaw in the Froxlor server administration control panel allows attackers to completely bypass Two-Factor Authentication (2FA) by issuing commands directly through the API. The API authentication routine in 'FroxlorRPC::validateAuth' fails to check the account's 2FA status, enabling arbitrary execution of administrative and customer actions. Furthermore, in versions prior to 2.3.7, API keys could be created without validating the current user password, exposing users to persistent backdoor access via session hijacking or CSRF.

Alon Barad
Alon Barad
0 views•5 min read
•40 minutes ago•CVE-2026-42342
7.5

CVE-2026-42342: Uncontrolled Resource Consumption and Denial of Service in React Router and Remix

An Uncontrolled Resource Consumption vulnerability (CWE-400) affects React Router in Framework Mode and Remix server runtimes. A remote, unauthenticated attacker can trigger unbounded recursive path expansion in the manifest resolution component, leading to 100% CPU exhaustion and complete Denial of Service. The vulnerability arises because the server does not enforce depth limits when parsing deeply nested path segments in requests directed to the dynamic manifest evaluation endpoints. This blocks the single-threaded Node.js event loop, preventing the processing of subsequent client requests. The issue is resolved in react-router v7.15.0 and @remix-run/server-runtime v2.17.5. Applications using React Router in client-side-only Declarative or Data modes are unaffected.

Amit Schendel
Amit Schendel
4 views•6 min read
•about 2 hours ago•CVE-2022-31114
5.1

CVE-2022-31114: Reflected Cross-Site Scripting in Laravel Backpack Error Views

CVE-2022-31114 is a Reflected Cross-Site Scripting (XSS) vulnerability affecting the popular administrative panel package 'backpack/crud'. The flaw is rooted in the unsafe, raw rendering of PHP exception messages within the default error templates. When an unescaped exception message reflects malicious user-provided input, arbitrary JavaScript can execute within an administrator's browser session.

Alon Barad
Alon Barad
5 views•6 min read
•about 4 hours ago•CVE-2024-52011
7.5

CVE-2024-52011: Remote Command Injection in ViteJS launch-editor

CVE-2024-52011 is a critical command injection vulnerability in the ViteJS launch-editor utility (versions prior to 2.9.0) affecting Windows environments. Unsanitized command-line arguments can lead to remote code execution on a developer workstation via cross-origin requests targeting the local development server.

Amit Schendel
Amit Schendel
3 views•7 min read
•about 10 hours ago•CVE-2025-10230
10.0

CVE-2025-10230: Samba Active Directory Domain Controller WINS Server Hook Command Injection

A critical OS command injection vulnerability exists in Samba's Windows Internet Name Service (WINS) server implementation when configured to run as an Active Directory Domain Controller (AD DC). Unsanitized NetBIOS name data extracted from WINS registration packets is directly concatenated into a shell command invocation and executed via Samba's wins hook parameter.

Amit Schendel
Amit Schendel
6 views•6 min read
•about 11 hours ago•GHSA-XQ3M-2V4X-88GG
9.8

CVE-2026-41242: Remote Code Execution via Dynamic Code Generation in protobufjs

CVE-2026-41242 is a critical code injection vulnerability in protobufjs. The library compiles custom serialization functions at runtime using the `Function` constructor. Prior to versions 7.5.5 and 8.0.1, dynamic type names were not sanitized, allowing an attacker to inject arbitrary JavaScript via crafted schema definitions, leading to remote code execution.

Amit Schendel
Amit Schendel
6 views•7 min read