Next-js CVE-2025–29927 güvenlik açığı
Next.js middleware could be bypassed by sending a crafted x-middleware-subrequest header, causing the middleware to be skipped entirely. An attacker could then access protected routes without authentication or authorization, and potentially trigger cache poisoning leading to denial of service.
medium.com
Published on medium.com
Merhaba arkadaşlar, ben İbrahimsql. Bugün en çok kullanılan popüler frameworklerden ve SaaS olarak çok kullanılan Vercel’in geliştirdiği Next.js’deki 9.1 kritik bir güvenlik açığını anlatacağım.
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, Next.js incorrectly trusted the x-middleware-subrequest header and skipped running middleware when it was present, instead of treating it as an internal-only signal.
Impact
Attackers could bypass authentication and authorization to access protected routes, and in some configurations cause cache poisoning leading to denial of service; the text also mentions potential CSP bypass and XSS, but these are described as scenarios rather than confirmed exploits.
What the attacker needed
Next.js app uses middleware for auth; Attacker can send HTTP requests
The fix
The vulnerability was fixed in Next.js 15.2.3 and 14.2.25; for older versions, the recommended workaround is to strip the x-middleware-subrequest header from external requests at a load balancer, custom middleware, or web server.
How it was found
- Identify a Next.js application that uses middleware for authorization.
- Send an HTTP request to a protected route with the x-middleware-subrequest header added.
- Observe that the middleware is skipped and the request reaches the protected handler.
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. This bug let anyone skip that check by adding a special header to their request, so they could see pages meant only for logged-in users.
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.