Skip to main content

Improper Authorization

CVE-2023-48309

Severity Medium
Score 5.3/10

Summary

NextAuth.js provides authentication for Next.js. In `next-auth` package versions through 4.24.4, 5.0.0-beta.0 through 5.0.0-beta3 and in @auth/core package versions through to 0.18.0, that rely on the default Middleware authorization are affected by a vulnerability. 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 or 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). As a workaround, developers can manually do a basic authentication using a custom authorization callback for Middleware.

  • LOW
  • NETWORK
  • NONE
  • UNCHANGED
  • NONE
  • NONE
  • LOW
  • NONE

CWE-285 - Improper Authorization

The software does not perform or incorrectly performs an authorization check when an actor attempts to access a resource or perform an action.

Advisory Timeline

  • Published