CVE-2026-73418
JSON

7.5high

NextAuth.js: getToken() throws an uncaught exception on malformed Bearer authorization headers

Severity
7.5high CVSS:3.1 by GitHub_M
Exploit likelihood
0.88% (higher than 57% of CVEs)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-xmf8-cvqr-rfgj

Description

NextAuth.js provides authentication for Next.js. Prior to @auth/core 0.41.3 and next-auth 4.24.15 and 5.0.0-beta.32, the exported getToken() helper in the next-auth/jwt and @auth/core/jwt modules can throw an uncaught exception when it reads a malformed Authorization: Bearer header. When no session cookie is present, getToken() URL-decodes the bearer value before validating it, and malformed percent encoding causes decodeURIComponent() to throw instead of treating the token as invalid. Because getToken() is commonly called in API routes, middleware, and server-side request handlers, a single unauthenticated request can trigger an unhandled exception in code paths that authenticate requests, causing a per-request denial of service without exposing tokens, sessions, or other data and without bypassing authentication. This issue is fixed in @auth/core 0.41.3 and next-auth 4.24.15 and 5.0.0-beta.32.

Affected

Product or packageVersionsReported by
nextauthjs next-auth>= 4.0.6, <= 4.24.14, >= 5.0.0-beta.0, <= 5.0.0-beta.31CVE List
@auth core>= 0.1.0, < 0.41.3CVE List
@auth/core (npm)from 0.1.0 before 0.41.3GitHub Advisory Database
next-auth (npm)from 5.0.0-beta.0 before 5.0.0-beta.32, from 4.0.6 before 4.24.15GitHub Advisory Database

All scores

GitHub_M7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Classification

CWE-20CWE-248

SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.

What each source says

CVE List

NextAuth.js provides authentication for Next.js. Prior to @auth/core 0.41.3 and next-auth 4.24.15 and 5.0.0-beta.32, the exported getToken() helper in the next-auth/jwt and @auth/core/jwt modules can throw an uncaught exception when it reads a malformed Authorization: Bearer header. When no session cookie is present, getToken() URL-decodes the bearer value before validating it, and malformed percent encoding causes decodeURIComponent() to throw instead of treating the token as invalid. Because getToken() is commonly called in API routes, middleware, and server-side request handlers, a single unauthenticated request can trigger an unhandled exception in code paths that authenticate requests, causing a per-request denial of service without exposing tokens, sessions, or other data and without bypassing authentication. This issue is fixed in @auth/core 0.41.3 and next-auth 4.24.15 and 5.0.0-beta.32.

GitHub Advisory Database

Summary

The exported getToken() helper (next-auth/jwt and @auth/core/jwt) can throw an uncaught exception when it reads a malformed Authorization: Bearer … header. When no session cookie is present, getToken() URL-decodes the bearer value before validating it, and malformed percent-encoding causes the decode step to throw rather than being treated as an invalid token. Because getToken() is commonly called in API routes, middleware, and other request handlers, a single unauthenticated request can trigger an unhandled exception in code paths that authenticate requests.

Am I affected?

You are affected if all of the following hold:

  • You use next-auth <= 5.0.0-beta.25 (or @auth/core exposing the same getToken() implementation).
  • Your application calls getToken() directly — for example in a Route Handler, middleware, or server-side request handler.
  • You do not wrap that getToken() call in your own try/catch.

You are not affected if you only use the framework's auth() helper and never call getToken() yourself, or if every getToken() call site already has its own exception handling.

Impact

  • Denial of service: an unauthenticated request carrying a malformed Bearer authorization header can raise an unhandled exception in any handler that calls getToken().
  • The impact is per-request and limited to availability; it does not expose tokens, sessions, or other data, and does not bypass authentication.

CWE-20: Improper Input Validation.

Patched version

The fix makes getToken() treat a malformed Bearer value as an invalid token and return null, matching how other undecodable tokens are already handled. Upgrade to the first release containing this fix (to be published; this advisory will be updated with the exact patched version before publication) and no code changes are required.

Workarounds

If you cannot upgrade immediately, either:

  • Config/code-level: wrap your getToken() calls so a thrown error is treated as "no token", e.g.

    let token = null
    try {
      token = await getToken({ req, secret })
    } catch {
      token = null
    }
    
  • Or strip/normalize the incoming Authorization header at the edge (proxy, middleware) before it reaches getToken(), rejecting values whose Bearer portion is not valid percent-encoding.

Credit

Reported by @deprrous. Thank you for the responsible disclosure.

References

https://github.com/nextauthjs/next-auth/security/advisories/GHSA-xmf8-cvqr-rfgjweb
https://github.com/nextauthjs/next-auth/pull/13469web
https://github.com/nextauthjs/next-auth/commit/5bca2399a79ba8d116ca5179b4b1ebcd152e7f05web
https://github.com/nextauthjs/next-auth/commit/e707770f00c52b3479e43422b0200b059149ed53web
https://github.com/nextauthjs/next-auth/releases/tag/%40auth%2Fcore%400.41.3
https://github.com/nextauthjs/next-auth/releases/tag/next-auth%404.24.15
https://github.com/nextauthjs/next-auth/releases/tag/next-auth%405.0.0-beta.32
https://nvd.nist.gov/vuln/detail/CVE-2026-73418advisory
https://github.com/nextauthjs/next-auth/pull/13467web
https://github.com/nextauthjs/next-authpackage
https://github.com/nextauthjs/next-auth/releases/tag/@auth/core@0.41.3web
https://github.com/nextauthjs/next-auth/releases/tag/next-auth@4.24.15web

Sources

SourceRecordLicence
CVE ListCVE-2026-73418 changed 2026-08-13CVE Terms of Use
GitHub Advisory DatabaseGHSA-xmf8-cvqr-rfgj changed 2026-09-10CC-BY-4.0
NVDCVE-2026-73418 changed 2026-09-09Public domain