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

CVE-2025-32421: Vercel Next.js Race Condition Vulnerability

CVE-2025-32421 is a race condition vulnerability in Vercel Next.js that causes Pages Router endpoints to serve pageProps data instead of HTML under certain misconfigurations. This article covers technical details, affected versions, and mitigation strategies.

Published:

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2025-32421 Overview

CVE-2025-32421 is a race condition vulnerability in Next.js, the React framework for building full-stack web applications. The flaw affects the Pages Router component in versions prior to 14.2.24 and 15.1.6. Under specific misconfigurations, normal endpoints can serve pageProps JSON data instead of the expected HTML response. The issue stems from how Next.js handles the x-now-route-matches header on incoming requests. Applications hosted on Vercel's platform are not affected because the platform does not cache responses based solely on 200 OK status without explicit cache-control headers. Self-hosted Next.js deployments behind a caching content delivery network (CDN) are the primary risk population. The vulnerability is tracked under [CWE-362] (Concurrent Execution using Shared Resource with Improper Synchronization).

Critical Impact

Attackers can trigger cache poisoning that serves internal pageProps data to downstream users of self-hosted Next.js applications.

Affected Products

  • Vercel Next.js versions prior to 14.2.24
  • Vercel Next.js versions prior to 15.1.6
  • Self-hosted Next.js deployments using the Pages Router behind a caching CDN

Discovery Timeline

  • 2025-05-14 - CVE-2025-32421 published to the National Vulnerability Database (NVD)
  • 2026-06-17 - Last updated in the NVD database

Technical Details for CVE-2025-32421

Vulnerability Analysis

The vulnerability affects the Pages Router in Next.js, which handles file-based routing for traditional React page components. Under certain misconfigurations, a race condition in request handling causes the framework to return pageProps JSON data instead of the standard HTML response for a given endpoint. When a CDN or reverse proxy caches this anomalous response, subsequent users receive the cached JSON output instead of the intended HTML page. The root condition belongs to the race condition category [CWE-362], where concurrent request processing produces an unintended response variant. Exploitation requires network access to the application and relies on the application being self-hosted behind a cache that stores 200 OK responses without honoring explicit cache-control directives.

Root Cause

The x-now-route-matches header, which Next.js uses internally for route resolution on Vercel infrastructure, is honored when supplied by external clients in self-hosted configurations. When an attacker sets this header on a request to a Pages Router endpoint, Next.js resolves the request as an internal data fetch, returning pageProps JSON. The maintainers patched the issue in versions 15.1.6 and 14.2.24 by stripping the x-now-route-matches header from incoming requests before processing.

Attack Vector

An unauthenticated attacker sends a crafted HTTP request to a self-hosted Next.js application containing an attacker-controlled x-now-route-matches header. The response contains the raw pageProps payload rather than the rendered HTML. If an upstream CDN caches the response, all subsequent requests for that URL receive the leaked data payload. The attack succeeds only when the CDN caches responses without requiring explicit cache-control headers. The vulnerability does not permit remote code execution, authentication bypass, or data modification. Impact is limited to confidentiality of the data embedded in pageProps for affected routes.

Detection Methods for CVE-2025-32421

Indicators of Compromise

  • Inbound HTTP requests containing the x-now-route-matches header from external clients
  • Cached CDN responses returning JSON pageProps payloads for URLs that should serve HTML documents
  • Unexpected spikes in Content-Type: application/json responses from routes registered under the Pages Router

Detection Strategies

  • Inspect CDN and web application firewall (WAF) logs for requests carrying the x-now-route-matches header originating outside the Vercel edge network
  • Compare response Content-Type distributions per route against baseline expectations for Pages Router endpoints
  • Review cache storage for entries whose body begins with {"pageProps": on routes documented as HTML

Monitoring Recommendations

  • Alert on any client request containing the x-now-route-matches header at the CDN or load balancer tier
  • Track the Next.js runtime version across self-hosted deployments and flag instances below 14.2.24 or 15.1.6
  • Monitor CDN cache hit ratios and payload sizes for anomalies that could indicate a poisoned cache entry

How to Mitigate CVE-2025-32421

Immediate Actions Required

  • Upgrade Next.js to version 14.2.24, 15.1.6, or later across all self-hosted deployments
  • Configure the CDN or reverse proxy to strip the x-now-route-matches header from all inbound requests
  • Set cache-control: no-store for responses on routes that should never be cached
  • Audit existing CDN caches and purge any entries containing unexpected pageProps JSON payloads

Patch Information

The Next.js maintainers released fixed versions 14.2.24 and 15.1.6. The patch strips the x-now-route-matches header from incoming requests before route resolution. Review the GitHub Security Advisory GHSA-qpjv-v59x-3qc4 and the Vercel changelog entry for CVE-2025-32421 for complete vendor guidance.

Workarounds

  • Strip the x-now-route-matches header from all incoming requests at the CDN edge
  • Enforce cache-control: no-store on responses for routes handling sensitive pageProps data
  • Only cache responses that carry explicit cache-control headers, as recommended by the Next.js maintainers
  • Applications hosted on Vercel require no action, since the platform does not cache responses based solely on 200 OK status
bash
# Example NGINX configuration to strip the vulnerable header
proxy_set_header x-now-route-matches "";
add_header Cache-Control "no-store" always;

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

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.