Auth bypass in Nextauth.js Next-Auth
CVE-2022-35924
NextAuth.js is a complete open source authentication solution for Next.js applications. `next-auth` users who are using the `EmailProvider` either in versions before `4.10.3` or `3.29.10` are affected. If an attacker could forge a request that sent a comma-separated list of emails (eg.: `attacker@attacker.com,victim@victim.com`) to the sign-in endpoint, NextAuth.js would send emails to both the attacker and the victim's e-mail addresses. The attacker could then login as a newly created user with the email being `attacker@attacker.com,victim@victim.com`. This means that basic authorization like `email.endsWith("@victim.com")` in the `signIn` callback would fail to communicate a threat to the developer and would let the attacker bypass authorization, even with an `@attacker.com` address. This vulnerability has been patched in `v4.10.3` and `v3.29.10` by normalizing the email value that is sent to the sign-in endpoint before accessing it anywhere else. We also added a `normalizeIdentifier` callback on the `EmailProvider` configuration, where you can further tweak your requirements for what your system considers a valid e-mail address. (E.g.: strict RFC2821 compliance). Users are advised to upgrade. There are no known workarounds for this vulnerability. If for some reason you cannot upgrade, you can normalize the incoming request using Advanced Initialization.
Vulnerability class: Drupalgeddon 2 (CVE-2018-7600)
Published · last modified .
CVSS v3 metric
CVSS v3 base score 9.1 (Critical). Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N.
EPSS exploit prediction
EPSS: 0.014 (71.9th percentile), scored .
Low probability of exploitation in the next 30 days, but still tracked. 72nd percentile — 71.9% of CVEs in the catalogue have a lower EPSS than this one. How to read EPSS.
EPSS over last 30 days · oldest: 0.014 · newest: 0.014 · change: +0.000
Affected products
- Nextauth.js Next-Auth
- Nextauthjs Next-Auth — versions >= 4.0.0, < 4.10.3, < 3.29.10
Weakness classification (CWE)
References
- next-auth.js.org/configuration/initialization (Vendor Advisory)
- github.com/nextauthjs/next-auth/security/advisories/GHSA-xv97-c62v-4587 (Third Party Advisory, Mitigation)
- github.com/nextauthjs/next-auth/commit/afb1fcdae3cc30445038ef588e491d139b916003 (Patch, Third Party Advisory)
- en.wikipedia.org/wiki/Email_address (Third Party Advisory)
- next-auth.js.org/configuration/callbacks (Vendor Advisory)
- next-auth.js.org/providers/email (Vendor Advisory)
- next-auth.js.org/providers/email (Vendor Advisory)
- nodemailer.com/message/addresses (Third Party Advisory)
Frequently asked questions
- What is CVE-2022-35924?
- CVE-2022-35924 is a critical-severity vulnerability in Nextauth.js Next-Auth, classified under Improper Input Validation. CVSS score: 9.1/10. Published 2022-08-02.
- How severe is CVE-2022-35924?
- Critical severity. CVSS v3 base score is 9.1 out of 10.