Mittel

Possible user mocking that bypasses basic authentication

  • Veröffentlicht: 20.11.2023
  • Aktualisiert: 11.10.2026 10:22

Impact

next-auth applications prior to version 4.24.5 that rely on the default Middleware authorization are affected.

A bad actor could create an empty/mock user, by getting hold of a NextAuth.js-issued JWT from an interrupted OAuth sign-in flow (state, PKCE or nonce).

Manually overriding the next-auth.session-token cookie value with this non-related JWT would let the user simulate a logged in user, albeit having no user information associated with it. (The only property on this user is an opaque randomly generated string).

This vulnerability does not give access to other users' data, neither to resources that require proper authorization via scopes or other means. The created mock user has no information associated with it (ie. no name, email, access_token, etc.)

This vulnerability can be exploited by bad actors to peek at logged in user states (e.g. dashboard layout).

Note: Regardless of the vulnerability, the existence of a NextAuth.js session state can provide simple authentication, but not authorization in your applications. For role-based access control, you can check out our guide.

Patches

We patched the vulnerability in next-auth v4.24.5. To upgrade, run one of the following:

bash
npm i next-auth@latest
bash
yarn add next-auth@latest
bash
pnpm add next-auth@latest

Workarounds

Upgrading to latest is the recommended way to fix this issue. However, using a custom authorization callback for Middleware, developers can manually do a basic authentication:

ts
// middleware.ts
import { withAuth } from "next-auth/middleware"

export default withAuth(/*your middleware function*/, {
  // checking the existence of any property - besides `value` which might be a random string - on the `token` object is sufficient to prevent this vulnerability
  callbacks: { authorized: ({ token }) => !!token?.email }
})

References

Betroffene Software

Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.

PlattformPaketAnfällige VersionenBehoben in
npm-Paket next-auth < 4.24.5 4.24.5

Verweise

CVSS-Wert 5.3/10
CVSS-Vektor
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
Schwäche (CWE)
CWE-285
Plattform
npm
Paket
next-auth
Veröffentlicht
20.11.2023
Aktualisiert
11.10.2026 10:22

Quellen und Lizenzen

OSV / GitHub Advisory Database - GHSA-v64w-49xw-qq89 - CC BY 4.0

Schwachstellenhistorie: next-auth

Alle veröffentlichten Schwachstellen dieses Pakets (npm-Paket), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.

Alle (14) im Archiv
Einträge insgesamt
14
Erste → letzte
02.2021 07.2026
Ohne Fix
0
In Angriffen ausgenutzt
0

Verteilung nach Schweregrad

  • Kritisch 3
  • Hoch 4
  • Mittel 5
  • Niedrig 2

Veröffentlichungen pro Jahr

  1. 2021: 1
  2. 2022: 6
  3. 2023: 2
  4. 2024: 0
  5. 2025: 1
  6. 2026: 4
Schweregrad:
  1. Hoch · 7.5 CVE-2026-73418 >= 5.0.0-beta.0, < 5.0.0-beta.32, >= 4.0.6, < 4.24.15 5.0.0-beta.32, 4.24.15
  2. Kritisch CVE-2026-73420 >= 4.10.3, < 4.24.15, >= 5.0.0-beta.1, < 5.0.0-beta.32 4.24.15, 5.0.0-beta.32
  3. Possible user mocking that bypasses basic authentication dieser Eintrag
    Mittel · 5.3 CVE-2023-48309 < 4.24.5 4.24.5
  4. Kritisch · 9.1 CVE-2022-35924 >= 4.0.0, < 4.10.3, < 3.29.10 4.10.3, 3.29.10
  5. Hoch · 7.1 CVE-2022-31127 < 3.29.8, >= 4.0.0, < 4.9.0 3.29.8, 4.9.0
  6. Hoch · 7.5 CVE-2022-31093 < 3.29.5, >= 4.0.0, < 4.5.0 3.29.5, 4.5.0

Erkennen Sie Schwachstellen in Ihrer Anwendung

Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.

Anwendung verbinden
DockRay Newsletter

Anwendungssicherheit in Ihrem Postfach

Wichtige Schwachstellen, konkrete Empfehlungen und praktische Tipps für Ihre Anwendungen. Wählen Sie Ihre Technologien und verfolgen Sie, was für Ihr Projekt relevant ist.

  • Eine tägliche Zusammenfassung neuer Schwachstellen, auch kritischer.
  • Benachrichtigungen über wichtige Updates.
  • Praktische Tipps zur Sicherheit und Überwachung von Anwendungen.

Leer lassen, um Meldungen zu allen Technologien zu erhalten.

Kostenlos anmelden. In jeder E-Mail mit einem Klick abmelden.