Missing proper state, nonce and PKCE checks for OAuth authentication in next-auth
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Tampering, Spoofing
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · NVD. Fix status from CNA and GitHub. Impact type from CWE-352 and CWE-384.
Summary
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Total
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| nextauthjs | next-auth | before 4.20.1 | 4.20.1 | Patch available | CNA |
| — | next-auth (npm) | before 4.20.1 | 4.20.1 | Patch available | GHSA-7r7x-4c4q-c4qf |
- next-auth Vendornextauthjs Affected before 4.20.1 Fixed in 4.20.1 Patch available CNA
- next-auth (npm) Vendor— Affected before 4.20.1 Fixed in 4.20.1 Patch available GHSA-7r7x-4c4q-c4qf
CPE configurations NVD · 1
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:nextauth.js:next-auth:*:*:*:*:*:node.js:*:* | before 4.20.1 | Vulnerable | nextauthjs |
- cpe:2.3:a:nextauth.js:next-auth:*:*:*:*:*:node.js:*:* Versions before 4.20.1 Vulnerable ·nextauthjs
Remediation
- Fix · CNA next-auth (nextauthjs) Fixed in 4.20.1
- Fix · GHSA-7r7x-4c4q-c4qf next-auth (npm) Fixed in 4.20.1 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2023-27490
- 2026-10-03 Alias added: GHSA-7r7x-4c4q-c4qf
References
Other 10
- 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/
- https://danielfett.de/2020/05/16/pkce-vs-nonce-equivalent-or-not
- https://github.com/nextauthjs/next-auth
- https://github.com/nextauthjs/next-auth/compare/[email protected]@4.20.1#diff-cf9257195d0cb6a835ae4ff1fc73fe2cac0bab847efb0832c1f551209a972b47R55
- https://security.netapp.com/advisory/ntap-20230420-0006
More nextauthjs Next-auth vulnerabilities
- TI-2022-13171 Improper handling of email input in next-auth CVSS 3.1HIGH 7.1
- TI-2022-16351 Verification requests (magic link) sent to unwanted emails CVSS 3.1CRITICAL 9.1
- TI-2022-13137 Improper Handling of `callbackUrl` parameter in next-auth CVSS 3.1HIGH 7.5
- TI-2022-18639 NextAuth.js Upstash Adapter missing token verification CVSS 3.1HIGH 8.1
- TI-2023-26172 next-auth vulnerable to possible user mocking that bypasses basic authentication CVSS 3.1MEDIUM 5.3
- TI-2021-04410 Token verification bug in next-auth CVSS 3.1MEDIUM 6.1
Sources
- CVE-2023-27490 · CVE Program
- CVE-2023-27490 · NVD
- FIRST EPSS
- GHSA-7r7x-4c4q-c4qf · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences