ai newsDi., 1. Dez.

Next.js middleware is not your only login check: CVE-2025-29927 and 6 checks for AI-built apps

If your AI-built Next.js app protects pages with middleware only, one 2025 vulnerability shows why that is not enough. CVE-2025-29927 let an attacker skip Next.js middleware entirely by sending a crafted header. Anything that relied only on middleware to check a login was open. What happened The ad

dev.toSamstag 11:16 · 28.11.2 Min. Lesezeit
Bild: dev.to

If your AI-built Next.js app protects pages with middleware only, one 2025 vulnerability shows why that is not enough. CVE-2025-29927 let an attacker skip Next.js middleware entirely by sending a crafted header. Anything that relied only on middleware to check a login was open.

The advisory (rated critical) says it was possible to bypass authorization checks in a Next.js app if the check happened in middleware. Patched versions are 12.3.5, 13.5.9, 14.2.25 and 15.2.3. Sources are listed at the end.

Generated Next.js code often puts "redirect to /login if no session" in middleware.ts and then trusts it. The page, the route handler and the database query run with no second check. When middleware is skipped, misconfigured or does not match a path, nothing else stands in the way.

// app/api/orders/route.ts export async function GET ( ) { const session = await getSession ( ); if (! session ) return new Response ( "Unauthorized", { status: 401 } ); // query only this user's rows } Enter fullscreen mode Exit fullscreen mode Self-hosted versus hosted The advisory notes that apps hosted on Vercel and Netlify were not affected, and self-hosted apps using next start with output: standalone were. Do not take comfort in that. The fix for a single point of failure is a second check, not a host.

ProofForge checks your live site from the outside, the way a stranger would. It can see open API endpoints that answer without a login, exposed files and secret-shaped strings in shipped code. It cannot read your middleware or confirm your server-side checks are right, and it will say inconclusive when it cannot know.

Check your own app from the outside, free. Run the free ProofForge scan on your live URL. No account needed for the first scan. It looks at your public site the way a stranger would and says pass, fail or inconclusive, so you know what is confirmed and what it could not see. One-time reports start at $9: see pricing. Building with an AI agent? There is an MCP server so it can check before it deploys.

Quelle: dev.to (dev.to). Original öffnen