CVE-2026-145493: next-auth 4.2.0 through 4.24.15 Authentication Bypass via withAuth Middleware Path Prefix
next-auth 4.2.0 through 4.24.15 contains an authentication bypass vulnerability in the withAuth middleware handleMiddleware function due to unbounded startsWith prefix checks. Unauthenticated attackers can request routes like /api/authors or /next-admin to skip session checks and the authorized callback, reaching middleware-protected routes.
Affected Software
Event History
Frequently Asked Questions
Which deployments are exposed to this bypass?
Deployments using npm/next-auth versions 4.2.0 through 4.24.15 and relying on the withAuth middleware to enforce session checks or an authorized callback on protected routes are exposed. Routes whose paths begin with an excluded authentication or Next.js internal path prefix may be reachable without authentication.
What does an attacker need to exploit the issue?
An attacker does not need credentials or user interaction. Exploitation requires sending a request to a path that shares a prefix with a path excluded by the middleware, such as /api/authors or /_next-admin.
How can I determine whether a route is vulnerable?
Review middleware-protected routes and test whether a request to a similarly prefixed path can reach the route without a session. In particular, check paths beginning with /api/auth or /_next that are not themselves intended exclusions, and verify that the authorized callback is invoked.