CVE-2025–29927 Authorization bypass vulnerability identified in
Next.js versions 11.1.4 through 15.2.2 mishandled the internal x-middleware-subrequest header, which could be injected into external requests. An attacker could bypass middleware logic such as authentication or access control and reach protected pages.
Published on shauryasharma05.medium.com
The original lives on shauryasharma05.medium.com
We do not hold its text, 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 framework trusted a client-supplied header to decide a request was an internal subrequest, without validating that it really came from inside the app.
Impact
Attackers could bypass middleware-based authentication and access control to reach protected functionality without logging in.
What the attacker needed
Target runs Next.js 11.1.4 to 15.2.2; app relies on middleware for auth; ability to intercept and modify requests
The fix
Next.js should validate that the internal subrequest header genuinely originates from the framework itself rather than trusting it from external requests; the text does not state that a fix was applied.
How it was found
- Intercept a request to the target application with an intercepting proxy.
- Add the x-middleware-subrequest header to the request.
- Forward the modified request and observe that authentication was bypassed.
- Add a custom static header to the same request for further testing.
- Navigate to the events page to obtain the first flag.
- Repeat the same steps against the subdomain and use the create event function for the second flag.
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.
Middleware is code that runs before a page is served, often to check whether a user is logged in. Next.js used a special header to mark requests it made to itself, and it trusted that header even when it came from outside. By adding that header, a visitor could make the app think the request was internal and skip the login check.
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.