GHSA-xmf8-cvqr-rfgjHigh· 7.5▾ TwilightAuth.js: getToken() throws an uncaught exception on malformed Bearer authorization headers
▾ Twilight zone — High severity, or a signal on a lesser flaw
impact 41.3 · likelihood 0 · exploitation 0
Need a working PoC? Pro members can cast a request and our team develops one — it lands right here.
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.
You are affected if all of the following hold:
next-auth <= 5.0.0-beta.25 (or @auth/core exposing the same getToken() implementation).getToken() directly — for example in a Route Handler, middleware, or server-side request handler.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.
getToken().CWE-20: Improper Input Validation.
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.
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.
Reported by @deprrous. Thank you for the responsible disclosure.
@auth/core >= 0.1.0, < 0.41.3next-auth >= 5.0.0-beta.0, <= 5.0.0-beta.31next-auth >= 4.0.6, <= 4.24.14Upgrade to a patched release:
@auth/core 0.41.3next-auth 5.0.0-beta.32next-auth 4.24.15Connected by shared product, vendor, weakness, or advisory.
GHSA-x445-f3h2-j279Medium· 6.8Auth.js: OAuth state, nonce, and PKCE check cookies are not bound to the provider that created them
GHSA-7rqj-j65f-68whCriticalAuth.js: Email normalizer validates the address before Unicode normalization, allowing a homoglyph @ bypass
CVE-2021-45105Medium· 5.9Apache Log4j2 versions 2.0-alpha1 through 2.16.0 (excluding 2.12.3 and 2.3.1) did not protect from uncontrolled recursion from self-referential lookups
CVE-2020-3478High· 8.1A vulnerability in the REST API of Cisco Enterprise NFV Infrastructure Software (NFVIS) could allow an authenticated, remote attacker to overwrite certain files that should be restricted on an affected device
CVE-2020-3577High· 7.4A vulnerability in the ingress packet processing path of Cisco Firepower Threat Defense (FTD) Software for interfaces that are configured either as Inline Pair or in Passive mode could allow an unauthenticated, adjacent attacker to cause…
CVE-2020-3317High· 7.5A vulnerability in the ssl_inspection component of Cisco Firepower Threat Defense (FTD) Software could allow an unauthenticated, remote attacker to crash Snort instances