/

CVE-2026-73418

Severity:

HIGH RISK

(7.5)

Improper Input Validation (CWE-20) in NextAuth.js JWT

CVE-2026-73418

Awaiting Analysis

Vulnerability type

Category:

Improper Input Validation

CWE:

CWE-20, CWE-248

Impact:

Denial of Service

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

NextAuth.js can raise an uncaught exception when its getToken() helper processes a malformed Authorization: Bearer header with invalid percent encoding and no session cookie is present. An unauthenticated request may therefore cause a per-request denial of service in API routes, middleware, or server-side request handlers, without bypassing authentication or exposing sensitive data.

Affected context

The issue occurs in applications using the next-auth/jwt or @auth/core/jwt getToken() helper to authenticate requests. It becomes risky when a request lacks a session cookie, supplies a malformed bearer value, and the authentication path decodes that value before safely handling validation errors.

Exploit preconditions

  • Attack surface: HTTP endpoints, middleware, or server-side handlers that invoke getToken()
  • Required access: Ability to send unauthenticated HTTP requests to an exposed application route
  • Trigger point: Processing of an Authorization: Bearer header when no session cookie is available
  • Why exploitation is possible: Malformed percent encoding causes URL decoding to throw an exception that is not caught and converted into an invalid-token result

Why this happens

The underlying bug is improper input validation combined with an uncaught exception. The authentication helper decodes attacker-controlled bearer input before validation, but does not safely handle decoding failures caused by malformed percent encoding. This maps primarily to CWE-20: Improper Input Validation and secondarily to CWE-248: Uncaught Exception, because invalid request data can escape normal authentication error handling and disrupt request processing.

Potential impact

  • An attacker may cause individual authentication requests to fail
  • Application routes or middleware may return unexpected server errors
  • Repeated requests could consume resources or contribute to service degradation
  • Availability of affected API or server-side request paths could be reduced
  • Authentication may remain enforced, with no token or session disclosure expected

General mitigation guidance

Mitigation generally focuses on treating authorization headers as untrusted input and making token parsing failure-safe.

Common defensive patterns include:

  • Validate bearer-header structure and encoding before decoding
  • Catch decoding and parsing exceptions at the authentication boundary
  • Convert malformed tokens into ordinary authentication failures
  • Use secure-by-default authentication helpers that reject invalid input without propagating exceptions
  • Apply request-size, rate, and resource-consumption limits to public authentication paths
  • Run application components with only the privileges required for their responsibilities
  • Keep authentication and error-handling behavior consistent across routes, middleware, and server-side handlers

How teams detect issues like this

Organizations can detect this class of issue through:

  • Static analysis for URL-decoding operations on request-controlled values without adjacent exception handling
  • Code review checks for authentication helpers that parse headers before validating syntax and encoding
  • Tests covering malformed percent encoding, invalid bearer formats, missing cookies, and repeated requests
  • Runtime monitoring for spikes in server errors associated with authentication middleware
  • Policy enforcement requiring invalid credentials to produce controlled authentication failures rather than uncaught exceptions
  • Automated security review tools that identify unsafe request parsing and missing error boundaries

Sources

SourceLink
github.comgithub.com/nextauthjs/next-auth/commit/5bca2399a79ba8d116ca5179b4b1ebcd152e7f05
github.comgithub.com/nextauthjs/next-auth/commit/e707770f00c52b3479e43422b0200b059149ed53
github.comgithub.com/nextauthjs/next-auth/pull/13469
github.comgithub.com/nextauthjs/next-auth/releases/tag/%40auth%2Fcore%400.41.3
github.comgithub.com/nextauthjs/next-auth/releases/tag/next-auth%404.24.15
github.comgithub.com/nextauthjs/next-auth/releases/tag/next-auth%405.0.0-beta.32
github.comgithub.com/nextauthjs/next-auth/security/advisories/GHSA-xmf8-cvqr-rfgj

Frequently asked

questions

No. The described behavior causes request-processing failures and does not allow an attacker to obtain valid sessions, bypass authentication, or expose tokens.

An attacker generally only needs the ability to send HTTP requests to an application path that invokes the affected getToken() helper. No valid credentials are required.

Treat bearer-header values as untrusted, validate their syntax and encoding, and catch decoding failures so malformed tokens are rejected as ordinary authentication failures.

Use failure-safe parsing APIs, test malformed input at authentication boundaries, enforce consistent exception handling, and monitor public endpoints for repeated error-triggering requests.

Find out what's already
exploitable in your codebase.