- next-auth
- nextjs
- npm
- nodejs
- auth-bypass
- cve-2026-145493
news
next-auth v4 withAuth Middleware Prefix Check Skips Session Checks, No Fix Yet (CVE-2026-145493)
Medium 6.3next-auth 4.2.0 through 4.24.15 skips the withAuth session check for any path that merely starts with the auth path or /_next, so routes like /api/authors or /_next-admin are reachable without a session. CVE-2026-145493, CVSS 4.0 6.3 (VulnCheck). No fix: 4.24.15 is the current release. No reported exploitation. Not in CISA KEV.
- Record
- CVE-2026-145493
- Score
- Medium 6.3
- Status
- Not KEVChecked, not listed
- Organization
- VulnCheck
Summary
If you protect Next.js routes with the next-auth v4 withAuth middleware, some route names are never checked. CVE-2026-145493 (CVSS 4.0 6.3 Medium, CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N; CVSS 3.1 4.8) is a plain prefix match. handleMiddleware returns early, with no session check and no authorized callback, for any path that starts with the auth path (/api/auth by default) or with /_next. So /api/authors, /api/authz or /_next-admin pass straight through. Affects 4.2.0 through 4.24.15. There is no fixed release: 4.24.15 is the current latest on npm.
Status: Disclosed. Not in CISA KEV catalog 2026.12.04, checked against the KEV JSON feed on 5 December 2026.
Vulnerability details
| CVE | Component and mechanism | Severity | Affected | Fixed in |
|---|---|---|---|---|
| CVE-2026-145493 | handleMiddleware in packages/next-auth/src/next/middleware.ts uses unbounded startsWith checks on the auth path and /_next (CWE-187) | CVSS 4.0 6.3 Medium, CVSS 3.1 4.8 | 4.2.0 to 4.24.15 | No fix at check time |
- Prerequisites: the app relies on
withAuth(orexport { default } from "next-auth/middleware") to protect a route whose path starts with the auth path or/_next. Routes with other names are not affected by this bug. - What the code does: in 4.24.15 the early return is
${basePath}${pathname}.startsWith(authPath)orpublicPaths.some((p) => pathname.startsWith(p))withpublicPaths = ["/_next", "/favicon.ico"]`. There is no trailing slash or segment boundary. The sign-in and error pages use an exact match and are fine. - The
v4branch on GitHub had the same code when checked on 5 December 2026, so no fix is waiting unreleased there either. - Scope: the CVE record names next-auth 4.x only. Auth.js v5 was not checked here.
- Scoring note: VulnCheck, the CNA, published both scores. NVD lists the record (published 5 December 2026, 03:20 UTC) with no NVD analysis at check time.
- Credit: Zachariah Mithani (AploSec), per the VulnCheck advisory.
Exploitation status
- Public PoC: none needed beyond the route name itself; none was looked for or run.
- In the wild: no reports.
- KEV: not listed in catalog
2026.12.04. - Confidence: High. The CNA record matches the published 4.24.15 source, read directly.
Operator actions
- List your protected routes and the middleware
matcher. Any protected path that starts with/api/auth(or your customNEXTAUTH_URLpath) or/_nextwithout being part of next-auth itself is exposed. Rename it or move it under a different prefix. - Do not let middleware be the only check. Call
getServerSession()in API route handlers, server components and server actions that return or change data. - Check access logs for unauthenticated 200 responses on those route names.
- Watch the next-auth releases for a 4.x fix and upgrade when it lands. Moving to Auth.js v5 is a larger change and was not evaluated here.