Miggo Logo

CVE-2025-29927:
Authorization Bypass in Next.js Middleware

9.1

CVSS Score

Basic Information

EPSS Score
-
Published
3/21/2025
Updated
3/24/2025
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
nextnpm>= 13.0.0, < 13.5.913.5.9
nextnpm>= 14.0.0, < 14.2.2514.2.25
nextnpm>= 15.0.0, < 15.2.315.2.3
nextnpm>= 11.1.4, < 12.3.512.3.5

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The analysis focused on the modified functions in the patches that directly relate to the handling of the 'x-middleware-subrequest' header. The 'initialize' function is critical as it sets up the routing and can allow unauthorized access if not properly secured. The 'filterInternalHeaders' function is essential for filtering out potentially malicious headers, and the 'context.ts' function is involved in setting headers that could be exploited. Each function was linked to specific changes in the patches that indicate their role in the vulnerability.

Vulnerable functions

initialize
packages/next/src/server/lib/router-server.ts
This function initializes the router and handles incoming requests. The vulnerability arises from the fact that it does not properly validate the 'x-middleware-subrequest' header, allowing unauthorized access to routes.
filterInternalHeaders
packages/next/src/server/lib/server-ipc/utils.ts
This function processes headers and is critical in filtering out the 'x-middleware-subrequest' header. If this header is not properly filtered, it can lead to unauthorized access by bypassing middleware checks.
context.ts
packages/next/src/server/web/sandbox/context.ts
This function sets the 'x-middleware-subrequest-id' header, which is used to track middleware subrequests. If this header is manipulated, it can lead to bypassing authorization checks.

WAF Protection Rules

WAF Rule

# Imp**t It is possi*l* to *yp*ss *ut*oriz*tion ****ks wit*in * N*xt.js *ppli**tion, i* t** *ut*oriz*tion ****k o**urs in mi**l*w*r*. # P*t***s * *or N*xt.js **.x, t*is issu* is *ix** in `**.*.*` * *or N*xt.js **.x, t*is issu* is *ix** in `**.*.**`

Reasoning

T** *n*lysis *o*us** on t** mo*i*i** *un*tions in t** p*t***s t**t *ir**tly r*l*t* to t** **n*lin* o* t** 'x-mi**l*w*r*-su*r*qu*st' *****r. T** 'initi*liz*' *un*tion is *riti**l *s it s*ts up t** routin* *n* **n *llow un*ut*oriz** ****ss i* not prop*