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.
Table of Contents
- What Happened in Next.js?
- Key Takeaways
- How the Vulnerability Works (Simple Explanation)
- What Makes This Dangerous?
- Risk Matrix
- Remediation: How to Fix It
- What If You're Using Vercel?
- Security Best Practices for Next.js Developers
- Conclusion
- Frequently Asked Questions (FAQs)
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:
-
Incremental Static Regeneration (ISR) using cache revalidation (in
next startor standalone deployments). -
Server-Side Rendering (SSR) combined with a CDN that caches 204 responses.
-
A shared response object used by Next.js that allows a race condition to occur.
Step-by-Step of the Attack
-
An attacker sends a request during cache revalidation.
-
Due to the race condition, the app incorrectly caches an HTTP 204 status (meaning “no content”).
-
That empty response gets stored in the cache.
-
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
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Wow
0
Sad
0
Angry
0