Next.js is a React framework for building full-stack web applications. Starting in version 1.11.4 and prior to versions 12.3.5, 13.5.9, 14.2.25, and 15.2.3, it is possible to bypass authorization checks within a Next.js application, if the authorization check occurs in middleware. If patching to a safe version is infeasible, it is recommend that you prevent external user requests which contain the x-middleware-subrequest header from reaching your Next.js application. This vulnerability is fixed in 12.3.5, 13.5.9, 14.2.25, and 15.2.3.
An attacker sends an HTTP request containing a specially crafted x-middleware-subrequest header. Next.js treats such a request as an internal middleware subrequest and skips the execution of authorization logic defined in the middleware layer. As a result, access controls — regardless of their implementation — are ignored, and the request reaches protected resources without permission verification. The issue affects all authorization checks placed solely in middleware.
An attacker can gain unauthorized access to protected application resources and manipulate data to which they should not normally have permissions, which constitutes a breach of confidentiality and integrity (CWE-285, CWE-863).
Next.js should be updated to version 12.3.5, 13.5.9, 14.2.25, or 15.2.3. If an immediate update is not possible, the vendor recommends blocking at the infrastructure level (reverse proxy, firewall, load balancer) all incoming external requests containing the x-middleware-subrequest header, so they do not reach the Next.js application.
Next.js versions from 1.11.4 to 12.3.4, from 13.0.0 to 13.5.8, from 14.0.0 to 14.2.24, and from 15.0.0 to 15.2.2 — all variants based on Vercel's Next.js framework where authorization logic is implemented in middleware.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:NVercel Next.js
APPVercel11.1.4 – 12.3.5 (excl.)13.0.0 – 13.5.9 (excl.)14.0.0 – 14.2.25 (excl.)15.0.0 – 15.2.3 (excl.)
Related vulnerabilities
RCE bez uwierzytelnienia w React Server Components (deserializacja)
Next.js: SSRF i Open Redirect przez niekontrolowane reguły rewrites/redirects
Ominięcie uwierzytelniania middleware w Next.js App Router z Turbopack
Vercel Next.js — nadmierne zużycie CPU przez spreparowane żądania (DoS)
SSRF w Next.js — przekierowanie żądań przez Server Actions do złośliwego hosta