Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2025-43865

CVE-2025-43865: React Router Data Spoofing Vulnerability

CVE-2025-43865 is a data spoofing vulnerability in React Router that allows attackers to modify pre-rendered data by adding headers to requests. This article covers technical details, affected versions, and mitigation.

Updated:

CVE-2025-43865 Overview

A high-severity insufficient verification of data authenticity vulnerability has been identified in React Router, a popular routing library for React applications. In versions on the 7.0 branch prior to version 7.5.2, attackers can modify pre-rendered data by adding a specially crafted header to the request. This vulnerability allows complete spoofing of pre-rendered content, enabling modification of all values within the data object passed to the HTML.

Critical Impact

Attackers can manipulate pre-rendered application data through header injection, potentially leading to data integrity violations and application state manipulation without authentication requirements.

Affected Products

  • React Router versions 7.0 through 7.5.1
  • Applications using React Router's pre-rendering feature
  • Server-side rendered React applications utilizing React Router 7.x

Discovery Timeline

  • 2025-04-25 - CVE CVE-2025-43865 published to NVD
  • 2025-04-29 - Last updated in NVD database

Technical Details for CVE-2025-43865

Vulnerability Analysis

This vulnerability is classified under CWE-345 (Insufficient Verification of Data Authenticity). The core issue stems from improper validation of request headers during the pre-rendering process in React Router. When processing requests, the server-side runtime fails to adequately verify the authenticity of certain headers, allowing attackers to inject malicious values that modify the pre-rendered data object.

The vulnerability affects the server-side rendering pipeline where build-time headers were being processed without proper contextual validation. This means that during normal runtime operations, headers intended only for build-time processing could still be read and processed, enabling data manipulation.

Root Cause

The root cause lies in the routes.ts file within the server-runtime package, specifically in how headers were processed without distinguishing between build-time and runtime contexts. The application failed to restrict access to build-time-only headers during normal request processing, creating an avenue for header-based data manipulation.

Attack Vector

The attack is network-accessible and requires no authentication or user interaction. An attacker can craft HTTP requests with specific headers that the React Router server-side runtime interprets as legitimate build-time directives. By manipulating these headers, the attacker can alter the pre-rendered data object that gets embedded into the HTML response, potentially affecting:

  • Application state initialization
  • User-visible content
  • Configuration data passed to the client
  • Security-sensitive application parameters
typescript
// Security patch in packages/react-router/lib/server-runtime/dev.ts - Adjust approach for prerendering/SPA mode via headers (#13453)
  // @ts-expect-error
  return globalThis[globalDevServerHooksKey];
}

// Guarded access to build-time-only headers
export function getBuildTimeHeader(request: Request, headerName: string) {
  if (typeof process !== "undefined") {
    try {
      if (process.env?.IS_RR_BUILD_REQUEST === "yes") {
        return request.headers.get(headerName);
      }
    } catch (e) {}
  }
  return null;
}

Source: GitHub Commit Reference

The patch introduces a getBuildTimeHeader function that guards access to build-time-only headers by checking for the IS_RR_BUILD_REQUEST environment variable, ensuring these headers are only processed during legitimate build operations.

typescript
// Security patch in packages/react-router-dev/vite/plugin.ts - Adjust approach for prerendering/SPA mode via headers (#13453)
            );
          }

+          // Set an environment variable we can look for in the handler to
+          // enable some build-time-only logic
+          process.env.IS_RR_BUILD_REQUEST = "yes";

          if (isPrerenderingEnabled(ctx.reactRouterConfig)) {
            // If we have prerender routes, that takes precedence over SPA mode
            // which is ssr:false and only the root route being rendered

Source: GitHub Commit Reference

Detection Methods for CVE-2025-43865

Indicators of Compromise

  • Unusual HTTP request headers targeting React Router pre-rendering functionality
  • Modified or unexpected content in pre-rendered HTML responses
  • Anomalous server-side rendering behavior or data inconsistencies
  • Request logs showing attempts to manipulate build-time headers during runtime

Detection Strategies

  • Monitor HTTP request headers for unexpected or malformed values targeting server-side rendering
  • Implement integrity checking for pre-rendered content to detect unauthorized modifications
  • Review application logs for discrepancies between expected and actual pre-rendered data
  • Deploy web application firewalls (WAF) with rules to detect header manipulation attempts

Monitoring Recommendations

  • Enable detailed logging for all server-side rendering operations
  • Set up alerts for requests containing unusual header patterns
  • Implement content integrity verification for pre-rendered pages
  • Monitor for changes in application behavior that could indicate data spoofing

How to Mitigate CVE-2025-43865

Immediate Actions Required

  • Upgrade React Router to version 7.5.2 or later immediately
  • Audit existing applications for signs of exploitation
  • Review server logs for suspicious header manipulation attempts
  • Implement input validation on server-side rendering pipelines

Patch Information

The vulnerability has been patched in React Router version 7.5.2. The fix introduces environment variable checks to ensure that build-time-only headers are only processed during legitimate build operations, not during runtime requests. The patch is available via the GitHub Commit Reference and detailed in the GitHub Security Advisory.

Workarounds

  • Implement a reverse proxy or WAF rule to strip or validate suspicious headers before they reach the application
  • Disable pre-rendering functionality temporarily if immediate upgrade is not possible
  • Add custom middleware to validate and sanitize incoming request headers
  • Consider using content integrity checks on pre-rendered data objects
bash
# Upgrade React Router to patched version
npm update react-router@7.5.2

# Or using yarn
yarn upgrade react-router@7.5.2

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.