How Next.js middleware authorization bypass works
Next.js adds an internal header to requests to stop middleware from calling itself in a loop. On self-hosted sites, nothing stopped an outside request from carrying that header too. Send it, and Next.js skips your middleware entirely.
If your login, admin or paywall checks run only in middleware, they could be bypassed. Sites hosted on Vercel or Netlify weren't affected. Sites running next start or the standalone output, including most Docker setups, were.
What attackers do with it
- Access to pages and API routes that only middleware was protecting, such as admin areas.
