What is the Next.js cache poisoning vulnerability (CVE-2025-49826) and how does it lead to Denial of Service (DoS) attacks?

A serious security flaw (CVE-2025-49826) was discovered in Next.js versions 15.1.0 to 15.1.8, allowing attackers to poison the cache and serve blank pages to users. This vulnerability impacts sites using Incremental Static Regeneration (ISR) with cache revalidation and Server-Side Rendering (SSR) where CDNs are configured to cache 204 HTTP responses. The issue arises due to a race condition with shared response objects, leading to persistent blank-page Denial of Service (DoS). The Next.js team has fully patched the bug in version 15.1.8. Immediate updates are strongly advised to prevent exploitation.

Jul 07, 2025 - 09:33
104.9k
What is the Next.js cache poisoning vulnerability (CVE-2025-49826) and how does it lead to Denial of Service (DoS) attacks?

Table of Contents

A critical vulnerability in Next.js, the popular React-based web framework, has raised serious concerns across the developer and cybersecurity community. Identified as CVE-2025-49826, this cache poisoning flaw allows attackers to create Denial of Service (DoS) conditions by delivering blank pages to all users.

Let’s break down what happened, how it works, who’s affected, and what you should do next.

 What Happened in Next.js?

Versions 15.1.0 to 15.1.8 of Next.js contain a bug in how they handle HTTP 204 (No Content) responses. Under specific circumstances, this bug lets attackers poison the cache with an empty response. This means users visiting static pages could be served blank pages, effectively taking parts of the site offline.

 Key Takeaways

Insight Detail
CVE ID CVE-2025-49826
Impacted Versions Next.js 15.1.0 to 15.1.8
Impact Cache poisoning leads to DoS (blank pages for all users)
Exploit Conditions Affected version + ISR with revalidation + SSR with CDN caching 204 responses
CVSS Score 7.5 (High Severity)
Fixed In Next.js 15.1.8 and above

How the Vulnerability Works (Simple Explanation)

The vulnerability targets how Next.js handles cached HTTP 204 responses under specific setups involving:

  1. Incremental Static Regeneration (ISR) using cache revalidation (in next start or standalone deployments).

  2. Server-Side Rendering (SSR) combined with a CDN that caches 204 responses.

  3. A shared response object used by Next.js that allows a race condition to occur.

 Step-by-Step of the Attack

  1. An attacker sends a request during cache revalidation.

  2. Due to the race condition, the app incorrectly caches an HTTP 204 status (meaning “no content”).

  3. That empty response gets stored in the cache.

  4. Every other user requesting that page is now served a blank page, causing a Denial of Service.

 What Makes This Dangerous?

  • A DoS attack that doesn’t crash servers—but makes pages invisible.

  • Impacts high-traffic websites using ISR for performance.

  • May go unnoticed during development unless tested under real CDN configurations.

 Risk Matrix

Category Details
Affected Versions 15.1.0 to 15.1.8
Trigger SSR + ISR + CDN caching 204
Root Cause Race condition with shared response caching
Consequence Cached blank pages = DoS
Exploitability Remote, low complexity, high impact

 Remediation: How to Fix It

The Next.js team patched this issue in version 15.1.8, with the following changes:

  • Removed the faulty logic that allowed 204 responses to be cached.

  • Refactored how Next.js handles shared responses in the cache pipeline.

  • Ensured that race conditions in the cache don’t lead to inconsistent states.

 What You Should Do

  • Update to version 15.1.8+ immediately.

  • Test your ISR and SSR routes, especially those using cache revalidation.

  • Review your CDN settings to avoid caching 204 responses.

  • Monitor application logs for unusual 204 response spikes.

What If You're Using Vercel?

Good news: Vercel-hosted applications are not affected. Their internal CDN and ISR logic prevent this type of cache poisoning attack, according to their security advisory.

 Security Best Practices for Next.js Developers

Best Practice Why It Matters
Keep your Next.js version updated Vulnerabilities are frequently patched in minor versions.
Avoid caching 204 responses They may be seen as “no content” by browsers and CDNs.
Use independent response objects Prevent race conditions.
Test production-like deployments Many bugs only appear under CDN and ISR behavior.
Monitor for DoS symptoms High traffic + blank pages may signal cache poisoning.

Conclusion

This cache poisoning vulnerability in Next.js highlights how complex features like ISR, SSR, and CDN caching can introduce new attack vectors—even in popular frameworks. While the vulnerability is patched, it serves as a strong reminder to:

  • Test how your app handles different status codes.

  • Watch out for shared resource race conditions.

  • Stay current with framework updates, especially for production deployments.

FAQs

CVE-2025-49826 is a cache poisoning vulnerability in Next.js versions 15.1.0 to 15.1.8 that allows attackers to serve blank pages to users through a Denial of Service condition.

It involves exploiting a race condition that caches HTTP 204 (No Content) responses, which then get served to all users as blank pages.

All versions from 15.1.0 to 15.1.8 are affected.

It’s a response with no content. When cached incorrectly, it causes users to see a blank page.

ISR allows pages to be updated in the background while serving static content. It's commonly used for performance optimization.

Yes, the issue impacts Server-Side Rendering (SSR) routes with cache revalidation and CDN caching enabled.

It has a CVSS score of 7.5, which is considered high severity.

Update to Next.js version 15.1.8 or higher immediately.

It is remotely exploitable through crafted requests that trigger cache poisoning.

No, applications hosted on Vercel are not affected due to its unique deployment infrastructure.

It means inserting malicious or incorrect data into a cache, causing wrong content to be delivered to users.

It causes the cache to store an incorrect response (e.g., 204) due to timing issues in shared response handling.

No, it doesn’t crash servers but causes a Denial of Service by serving blank pages to users.

Yes, look for unusual spikes in HTTP 204 responses and complaints of blank pages from users.

No, caching 204 responses is not recommended as they contain no content and may lead to unexpected behavior.

Next.js caches rendered pages using ISR and SSR depending on configuration and uses shared response objects to optimize performance.

The patch removed the buggy code path and changed the caching architecture to avoid using shared responses.

Immediately—especially if you use ISR and SSR in production.

Yes, it can be triggered through backend conditions and specific route timing without the user knowing.

Blank pages delivered to search engines and users can harm SEO rankings and increase bounce rates.

Application performance monitoring (APM) tools and custom logging can help detect anomalies in response codes.

Yes, it’s specific to how Next.js handles ISR/SSR caching with shared responses.

High-traffic websites using static regeneration with SSR and CDN caching.

They help in general, but won’t prevent cache poisoning caused by internal framework bugs.

Not always. It requires real-time traffic and cache behavior to reproduce reliably.

Disabling ISR may reduce exposure, but updating to the patched version is the correct solution.

Yes, ensure 204 responses are not cached and investigate how the CDN handles content negotiation.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.