Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. next-auth
  4. ›
  5. GHSA-8fpg-xm3f-6cx3

GHSA-8fpg-xm3f-6cx3: Auth.js: Configuration errors can cause existence-based auth checks to fail open (auth object populated with an error)

July 23, 2026

next-auth (Auth.js) v5 applications that gate access by checking only for the existence of the auth object — the pattern shown in the official session management / protecting resources guide — are affected.

When the Auth.js configuration produces a server-side error, the auth object exposed by the auth() wrapper (in middleware, Route Handlers, etc.) is populated with an error object instead of being null:

{ "message": "There was a problem with the server configuration. Check the server logs for more information." }

Because this object is truthy, any authorization check of the form !!auth (or if (req.auth)) evaluates to true for every request, including unauthenticated ones. The application fails open: instead of denying access when the auth layer is broken, it grants access to everyone.

// middleware.ts — affected pattern
export default auth((req) => {
const { nextUrl, auth } = req
const isLoggedIn = !!auth // <-- always true when the configuration is broken
// ...
})

A representative trigger is a provider that is missing required configuration. For example, a Keycloak provider with neither issuer nor authorization endpoint set logs:

[auth][error] InvalidEndpoints: Provider "keycloak" is missing both `issuer` and `authorization` endpoint config. At least one of them is required.

…and from that point on auth is the error object above, so !!auth is permanently true. The same fail-open behavior occurs for other server-configuration errors (for example, an unset AUTH_SECRET).

There is no impact while the configuration is valid. The risk materializes when a previously-working deployment becomes misconfigured — e.g. an environment variable is changed or removed during a deploy — at which point existence-based auth checks silently stop protecting routes and all visitors are treated as authenticated. Because the failure mode is silent and grants access to everyone, the consequences can be severe.

This is an instance of CWE-636 (Not Failing Securely / “Failing Open”) leading to improper authorization (CWE-285).

References

  • github.com/advisories/GHSA-8fpg-xm3f-6cx3
  • github.com/nextauthjs/next-auth/commit/d008b9b764bf4b322a87e1822d1dda7789258d8f
  • github.com/nextauthjs/next-auth/releases/tag/next-auth@5.0.0-beta.32
  • github.com/nextauthjs/next-auth/security/advisories/GHSA-8fpg-xm3f-6cx3

Code Behaviors & Features

Detect and mitigate GHSA-8fpg-xm3f-6cx3 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 →

Affected versions

All versions starting from 5.0.0-beta.0 before 5.0.0-beta.32

Fixed versions

  • 5.0.0-beta.32

Solution

Upgrade to version 5.0.0-beta.32 or above.

Impact 9.1 CRITICAL

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N

Learn more about CVSS

Weakness

  • CWE-285: Improper Authorization
  • CWE-636: Not Failing Securely ('Failing Open')

Source file

npm/next-auth/GHSA-8fpg-xm3f-6cx3.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sat, 08 Aug 2026 00:17:54 +0000.