Exploiting Next.js Middleware Authorization Bypass (CVE-2025–29
Next.js middleware did not properly validate the x-middleware-subrequest header, allowing attackers to skip middleware execution entirely. An attacker could send a crafted header to access protected routes without authentication.
Published on medium.com
Next.js, a popular React framework for building server-rendered applications, recently disclosed a critical vulnerability (CVE-2025–29927) that allows attackers to bypass authorization checks implemented in middleware. This flaw affects all versions before 14.2.25, 15.2.3, 13.5.9, and 12.3.5, putting many production…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the middleware did not validate the x-middleware-subrequest header, allowing it to be set by an attacker to bypass execution.
Impact
An attacker could access protected routes without authentication, potentially exposing sensitive data or functionality.
What the attacker needed
Next.js version before 14.2.25, 15.2.3, 13.5.9, or 12.3.5; Target uses middleware for authorization
The fix
Upgrade Next.js to version 14.2.25, 15.2.3, 13.5.9, or 12.3.5 or later.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Next.js is a framework for building websites. Middleware is code that runs before a page is shown, often used to check if a user is logged in. The bug meant that a special header in a web request could tell the server to skip that check, so anyone could see protected pages without logging in.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.