{"id":"CVE-2026-73418","aliases":["EUVD-2026-57552","GHSA-xmf8-cvqr-rfgj"],"status":"published","title":"NextAuth.js: getToken() throws an uncaught exception on malformed Bearer authorization headers","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.","severity":{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-09","score":0.00877,"percentile":0.59292,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-20","CWE-248"],"published":"2026-07-23T14:42:55Z","modified":"2026-10-28T02:30:23Z","fixes":[{"ecosystem":"npm","package":"@auth/core","fixed_in":["0.41.3"],"sources":["ghsa","osv"]},{"ecosystem":"npm","package":"next-auth","fixed_in":["5.0.0-beta.32","4.24.15"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"@auth/core","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0.1.0"},{"fixed":"0.41.3"}]}]},{"source":"ghsa","ecosystem":"npm","package":"next-auth","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.0.0-beta.0"},{"last_affected":"5.0.0-beta.31"},{"fixed":"5.0.0-beta.32"}]}]},{"source":"ghsa","ecosystem":"npm","package":"next-auth","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"4.0.6"},{"last_affected":"4.24.14"},{"fixed":"4.24.15"}]}]},{"source":"osv","ecosystem":"npm","package":"@auth/core","ranges":[{"type":"SEMVER","events":[{"introduced":"0.1.0"},{"fixed":"0.41.3"}]}]},{"source":"osv","ecosystem":"npm","package":"next-auth","ranges":[{"type":"SEMVER","events":[{"introduced":"5.0.0-beta.0"},{"fixed":"5.0.0-beta.32"}]}]},{"source":"osv","ecosystem":"npm","package":"next-auth","ranges":[{"type":"SEMVER","events":[{"introduced":"4.0.6"},{"fixed":"4.24.15"}]}]}],"products":[{"vendor":"@auth","product":"core"},{"vendor":"nextauthjs","product":"next-auth"},{"vendor":"opnsense","product":"core"}],"references":[{"url":"https://github.com/nextauthjs/next-auth/security/advisories/GHSA-xmf8-cvqr-rfgj","tags":["x_refsource_CONFIRM","advisory","web"]},{"url":"https://github.com/nextauthjs/next-auth/pull/13469","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/nextauthjs/next-auth/commit/5bca2399a79ba8d116ca5179b4b1ebcd152e7f05","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/nextauthjs/next-auth/commit/e707770f00c52b3479e43422b0200b059149ed53","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/nextauthjs/next-auth/releases/tag/%40auth%2Fcore%400.41.3","tags":["x_refsource_MISC","web"]},{"url":"https://github.com/nextauthjs/next-auth/releases/tag/next-auth%404.24.15","tags":["x_refsource_MISC","web"]},{"url":"https://github.com/nextauthjs/next-auth/releases/tag/next-auth%405.0.0-beta.32","tags":["x_refsource_MISC","web"]},{"url":"https://github.com/nextauthjs/next-auth/pull/13467","tags":["web"]},{"url":"https://github.com/nextauthjs/next-auth/releases/tag/@auth/core@0.41.3","tags":["web"]},{"url":"https://github.com/nextauthjs/next-auth/releases/tag/next-auth@4.24.15","tags":["web"]},{"url":"https://github.com/nextauthjs/next-auth/releases/tag/next-auth@5.0.0-beta.32","tags":["web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-73418","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-xmf8-cvqr-rfgj"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/73xxx/CVE-2026-73418.json","tags":["advisory"]},{"url":"https://github.com/nextauthjs/next-auth","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2026-73418","title":"NextAuth.js: getToken() throws an uncaught exception on malformed Bearer authorization headers","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.","status":"published","published":"2026-08-12T20:21:11.318Z","modified":"2026-08-13T12:53:44.683Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high","assessor":"cna"}],"cwes":["CWE-20","CWE-248"],"updated_at":"2026-11-02T13:43:22.599321Z"}],"euvd":[{"id":"EUVD-2026-57552","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.","status":"published","published":"2026-08-12T20:21:11Z","modified":"2026-08-13T12:53:44Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high"}],"updated_at":"2026-11-02T18:01:56.761721Z"}],"ghsa":[{"id":"GHSA-xmf8-cvqr-rfgj","title":"Auth.js: getToken() throws an uncaught exception on malformed Bearer authorization headers","description":"## Summary\n\nThe 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.\n\n## Am I affected?\n\nYou are affected if **all** of the following hold:\n\n- You use `next-auth` `\u003c= 5.0.0-beta.25` (or `@auth/core` exposing the same `getToken()` implementation).\n- Your application calls `getToken()` directly — for example in a Route Handler, middleware, or server-side request handler.\n- You do not wrap that `getToken()` call in your own `try/catch`.\n\nYou 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.\n\n## Impact\n\n- Denial of service: an unauthenticated request carrying a malformed Bearer authorization header can raise an unhandled exception in any handler that calls `getToken()`.\n- The impact is per-request and limited to availability; it does not expose tokens, sessions, or other data, and does not bypass authentication.\n\nCWE-20: Improper Input Validation.\n\n## Patched version\n\nThe 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.\n\n## Workarounds\n\nIf you cannot upgrade immediately, either:\n\n- **Config/code-level:** wrap your `getToken()` calls so a thrown error is treated as \"no token\", e.g.\n\n  ```ts\n  let token = null\n  try {\n    token = await getToken({ req, secret })\n  } catch {\n    token = null\n  }\n  ```\n\n- 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.\n\n## Credit\n\nReported by @deprrous. Thank you for the responsible disclosure.","status":"published","published":"2026-07-23T14:42:55Z","modified":"2026-08-13T19:05:19Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high"}],"cwes":["CWE-20"],"updated_at":"2026-11-02T14:41:01.23108Z"}],"nvd":[{"id":"CVE-2026-73418","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.","status":"published","published":"2026-08-12T21:17:40.89Z","modified":"2026-09-09T20:58:37.713Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high","assessor":"secondary"}],"cwes":["CWE-20","CWE-248"],"updated_at":"2026-11-02T14:12:37.217486Z"}],"osv":[{"id":"CVE-2026-73418","title":"NextAuth.js: getToken() throws an uncaught exception on malformed Bearer authorization headers","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.","status":"published","published":"2026-08-12T20:21:11.318Z","modified":"2026-10-28T02:30:23.541821654Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high"}],"cwes":["CWE-20","CWE-248"],"updated_at":"2026-11-02T15:45:16.365946Z"},{"id":"GHSA-xmf8-cvqr-rfgj","title":"Auth.js: getToken() throws an uncaught exception on malformed Bearer authorization headers","description":"## Summary\n\nThe 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.\n\n## Am I affected?\n\nYou are affected if **all** of the following hold:\n\n- You use `next-auth` `\u003c= 5.0.0-beta.25` (or `@auth/core` exposing the same `getToken()` implementation).\n- Your application calls `getToken()` directly — for example in a Route Handler, middleware, or server-side request handler.\n- You do not wrap that `getToken()` call in your own `try/catch`.\n\nYou 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.\n\n## Impact\n\n- Denial of service: an unauthenticated request carrying a malformed Bearer authorization header can raise an unhandled exception in any handler that calls `getToken()`.\n- The impact is per-request and limited to availability; it does not expose tokens, sessions, or other data, and does not bypass authentication.\n\nCWE-20: Improper Input Validation.\n\n## Patched version\n\nThe 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.\n\n## Workarounds\n\nIf you cannot upgrade immediately, either:\n\n- **Config/code-level:** wrap your `getToken()` calls so a thrown error is treated as \"no token\", e.g.\n\n  ```ts\n  let token = null\n  try {\n    token = await getToken({ req, secret })\n  } catch {\n    token = null\n  }\n  ```\n\n- 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.\n\n## Credit\n\nReported by @deprrous. Thank you for the responsible disclosure.","status":"published","published":"2026-07-23T14:42:55Z","modified":"2026-09-10T03:51:12.549867672Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high"}],"cwes":["CWE-20"],"updated_at":"2026-11-02T15:47:00.198893Z"}]}}
