GHSA-xmf8-cvqr-rfgj: Auth.js: getToken() throws an uncaught exception on malformed Bearer authorization headers
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.
References
- github.com/advisories/GHSA-xmf8-cvqr-rfgj
- github.com/nextauthjs/next-auth/commit/5bca2399a79ba8d116ca5179b4b1ebcd152e7f05
- github.com/nextauthjs/next-auth/commit/e707770f00c52b3479e43422b0200b059149ed53
- github.com/nextauthjs/next-auth/pull/13467
- github.com/nextauthjs/next-auth/pull/13469
- github.com/nextauthjs/next-auth/releases/tag/@auth/core@0.41.3
- github.com/nextauthjs/next-auth/releases/tag/next-auth@4.24.15
- github.com/nextauthjs/next-auth/releases/tag/next-auth@5.0.0-beta.32
- github.com/nextauthjs/next-auth/security/advisories/GHSA-xmf8-cvqr-rfgj
Code Behaviors & Features
Detect and mitigate GHSA-xmf8-cvqr-rfgj with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →