SecPod

Learn Search

Search across all Learn content

← Back to Security Research
Next Blunder: Next.js Users Urged to Patch Critical Security Flaw

Next Blunder: Next.js Users Urged to Patch Critical Security Flaw

A severe vulnerability tracked as CVE-2025-29927, with a CVSS score of 9.1, has been identified in the Next.js React framework. If exploited, it could result in an authentication bypass under specific conditions.

Mar 24, 2025By Santosh Sethuraman4 min read

A severe vulnerability tracked as CVE-2025-29927, with a CVSS score of 9.1, has been identified in the Next.js React framework. If exploited, it could result in an authentication bypass under specific conditions.

Next.js is a framework based on React that enables fast and scalable web application development. It supports server-side rendering (SSR), static site generation (SSG), and API routes. Created by Vercel, it provides automatic code splitting, image optimization, and built-in routing, rendering it perfect for contemporary web development with enhanced performance and SEO advantages.

Technical Details

As a comprehensive framework, Next.js includes built-in middleware that is key in authorization checks. It verifies session cookies and grants users the necessary permissions, ensuring access to specific paths remains protected under the required conditions.

The runMiddleware function in Next.js middleware checks the header’s value to determine whether middleware should be applied. If the correct value is added to this header, the request can bypass intermediary checks, overriding security rules. To exploit this, we need to identify the correct middlewareInfo.name. But how do we find it?

Surprisingly, middlewareInfo.name is highly predictable. To make an educated guess, we first must understand how middleware was configured in older versions.

Older Versions (Before Next.js 12.2)

Before version 12.2, middleware files had to be named _middleware.ts and placed inside the pages folder since the page router was the only available routing mechanism. Knowing this, we can construct a header that bypasses authorization checks entirely:

plaintext
middleware-subrequest: pages/_middleware

If the middleware is used in nested paths, it runs top-to-bottom. We have two additional possibilities for the middlewareInfo to access a path protected by middleware. name value. These values, when passed in the x-middleware-subrequest Header, also allow authorization bypass:

plaintext
middleware-subrequest: pages/dashboard/_middleware

or

plaintext
middleware-subrequest: pages/dashboard/panel/_middleware

Next.js 12.2 and Later

Starting with version 12.2, middleware files no longer require an underscore in their name, nor do they need to be placed inside the pages folder. This simplifies the exploitation process. However, newer versions introduce the option to create a /src directory. Taking both scenarios into account, the header should look like one of the following:

plaintext
middleware-subrequest: middleware

or

plaintext
middleware-subrequest: src/middleware

Recent Versions and MAX_RECURSION_DEPTH

In more recent versions, an additional factor comes into play: MAX_RECURSION_DEPTH, which is set to 5 by default. Since there are only two possible filenames (middleware or src/middleware), we can construct a header that takes advantage of this recursion limit:

plaintext
middleware-subrequest: middleware:middleware:middleware:middleware:middleware

or

plaintext
middleware-subrequest: src/middleware:src/middleware:src/middleware:src/middleware:src/middleware

Final Exploitation Step

If we try to access a middleware-protected endpoint without using the correct header value or valid credentials, the request will return a 404 Not Found error. However, if we include the appropriate header in our request, we can bypass authentication and gain access.

Impact

The impact of this vulnerability is highly severe. They grant attackers full system access, which could allow them to obtain or modify sensitive data. The risk is further heightened by the attack’s low complexity.

Products Affected

The vulnerability impacts all Next.js versions before 15.2.3, 14.2.25, 13.5.9. and versions above 11.1.4 before 13.5.6.

Solution and Mitigation

For Next.js 14.x, this issue is fixed in 14.2.25. For Next.js 15.x, this issue is fixed in 15.2.3. For Next.js versions 11.1.4 through 13.5.6, we recommend consulting the workaround below.

Workaround

If updating to a secure version is not an option, we recommend blocking external user requests that include the x-middleware-subrequest header from reaching your Next.js application.

Instantly Fix Risks with SanerNow Patch Management

SanerNow patch management is a continuous, automated, and integrated software that instantly fixes risks exploited in the wild. The software supports major operating systems like Windows, Linux, and macOS, as well as 550+ third-party applications.

It also allows you to set up a safe testing area to test patches before deploying them in a primary production environment. SanerNow patch management additionally supports a patch rollback feature in case of patch failure or a system malfunction.

Experience the fastest and most accurate patching software here.

Featured Posts

Open November 2026 Linux Security Updates for Debian, Fedora, Red Hat and Ubuntu: Critical Browser, .NET and Enterprise Infrastructure Vulnerabilities
November 2026 Linux Security Updates for Debian, Fedora, Red Hat and Ubuntu: Critical Browser, .NET and Enterprise Infrastructure Vulnerabilities

CVE Research

November 2026 Linux Security Updates for Debian, Fedora, Red Hat and Ubuntu: Critical Browser, .NET and Enterprise Infrastructure Vulnerabilities

Nov 27, 2026

Open Drupal Installer Flaw Under Attack: Site Takeover Risk Persists
vulnerability researchDrupal Installer Flaw Under Attack: Site Takeover Risk Persists

CVE Research

Drupal Installer Flaw Under Attack: Site Takeover Risk Persists

CVE-2026-136716 is a highly critical Drupal core installer access-bypass vulnerability that is under active exploitation. An unauthenticated attacker can take over sites left in unusual or incomplete installation states, including some production sites. The earlier fix for CVE-2026-132165 does not cover every affected state. Fixed releases are Drupal Core 11.4.14, 11.3.23, and 10.6.23. This article covers how the flaw works, its relationship to the prior installer issue, impact, and remediation steps.

Nov 27, 2026

Open GT13 Campaign Targets 22 Organizations Through Check Point Security Management Server Exploitation
GT13 Campaign Targets 22 Organizations Through Check Point Security Management Server Exploitation

CVE Research

GT13 Campaign Targets 22 Organizations Through Check Point Security Management Server Exploitation

The GT13 campaign targeted at least 22 organizations worldwide by exploiting vulnerabilities in exposed services and Check Point Security Management Servers. The attackers used forged authentication sessions, SSH-based persistence, internal reconnaissance, lateral movement, and data exfiltration techniques to compromise systems and access sensitive information.

Nov 26, 2026

Open GeoServer Flaws Under Attack: Inside the Exploit Chain to Remote Code Execution
vulnerability researchGeoServer Flaws Under Attack: Inside the Exploit Chain to Remote Code Execution

CVE Research

GeoServer Flaws Under Attack: Inside the Exploit Chain to Remote Code Execution

Six vulnerabilities in GeoServer’s November 2026 security update can expose sensitive files, bypass service authorization, and enable administrator impersonation. Several of these flaws can be chained for unauthenticated remote code execution with the permissions of the GeoServer process. CVE-2026-120705 and CVE-2026-129243 have been reported as exploited. Fixed releases include GeoServer 3.0.2, 2.28.6, and 2.27.7. This article covers the flaws, the public five-CVE chain, impact, affected versions, and remediation guidance.

Nov 26, 2026