CVE-2022-31127
CVE-2022-31127 is a high-severity vulnerability in Nextauth.js Next-auth with a CVSS 3.x base score of 7.1. It is not currently listed as actively exploited by CISA, and its EPSS exploit-prediction score is low. The underlying weakness is classified as CWE-79.
Key facts
- Severity: High (CVSS 3.x base score 7.1)
- CVSS v2: 4.3
- EPSS exploit prediction: 1% (60th percentile)
- Actively exploited: Not listed in CISA KEV
- Weakness: CWE-79
- Affected product: Nextauth.js Next-auth
- Published:
- Last modified:
Description
NextAuth.js is a complete open source authentication solution for Next.js applications. An attacker can pass a compromised input to the e-mail [signin endpoint](https://next-auth.js.org/getting-started/rest-api#post-apiauthsigninprovider) that contains some malicious HTML, tricking the e-mail server to send it to the user, so they can perform a phishing attack. Eg.: `[email protected], <a href="http://attacker.com">Before signing in, claim your money!</a>`. This was previously sent to `[email protected]`, and the content of the email containing a link to the attacker's site was rendered in the HTML. This has been remedied in the following releases, by simply not rendering that e-mail in the HTML, since it should be obvious to the receiver what e-mail they used: next-auth v3 users before version 3.29.8 are impacted. (We recommend upgrading to v4, as v3 is considered unmaintained. next-auth v4 users before version 4.9.0 are impacted. If for some reason you cannot upgrade, the workaround requires you to sanitize the `email` parameter that is passed to `sendVerificationRequest` and rendered in the HTML. If you haven't created a custom `sendVerificationRequest`, you only need to upgrade. Otherwise, make sure to either exclude `email` from the HTML body or efficiently sanitize it.
Frequently asked questions
- What is CVE-2022-31127?
- NextAuth.js is a complete open source authentication solution for Next.js applications. An attacker can pass a compromised input to the e-mail [signin endpoint](https://next-auth.js.org/getting-started/rest-api#post-apiauthsigninprovider) that contains some malicious HTML, tricking the e-mail server to send it to the user, so they can perform a phishing attack. Eg.: `[email protected], <a href="http://attacker.com">Before signing in, claim your money!</a>`. This was previously sent to `[email protected]`, and the content of the email containing a link to the attacker's site was rendered in the HTML. This has been remedied in the following releases, by simply not rendering that e-mail in the HTML, since it should be obvious to the receiver what e-mail they used: next-auth v3 users before version 3.29.8 are impacted. (We recommend upgrading to v4, as v3 is considered unmaintained. next-auth v4 users before version 4.9.0 are impacted. If for some reason you cannot upgrade, the workaround requires you to sanitize the `email` parameter that is passed to `sendVerificationRequest` and rendered in the HTML. If you haven't created a custom `sendVerificationRequest`, you only need to upgrade. Otherwise, make sure to either exclude `email` from the HTML body or efficiently sanitize it.
- How severe is CVE-2022-31127?
- CVE-2022-31127 has a CVSS 3.x base score of 7.1, rated high severity. It is exploitable over network with low attack complexity, requires no privileges and user interaction. Impact on confidentiality is low, integrity low, and availability low.
- Is CVE-2022-31127 being actively exploited?
- It is not currently listed in CISA's KEV catalog. Its EPSS exploit-prediction score is 1% (60th percentile), an estimate of the probability of exploitation in the next 30 days.
- What products are affected by CVE-2022-31127?
- CVE-2022-31127 affects Nextauth.js Next-auth. See the affected-products list for the exact vulnerable versions.
- How do I fix CVE-2022-31127?
- Review the linked vendor and NVD advisories for patched versions and mitigations, then upgrade or apply the recommended workaround. Given its high severity, prioritise patching exposed systems.
- When was CVE-2022-31127 published?
- CVE-2022-31127 was published on 2022-07-06 and last updated on 2026-06-17.
References
- https://github.com/nextauthjs/next-auth/commit/ae834f1e08a4a9915665eecb9479c74c6b039c9c
- https://github.com/nextauthjs/next-auth/releases/tag/next-auth%40v4.9.0
- https://github.com/nextauthjs/next-auth/security/advisories/GHSA-pgjx-7f9g-9463
- https://next-auth.js.org/getting-started/upgrade-v4
- https://next-auth.js.org/providers/email#customizing-emails
Affected products (1)
- cpe:2.3:a:nextauth.js:next-auth:*:*:*:*:*:node.js:*:*
More vulnerabilities in Nextauth.js Next-auth
- CVE-2022-35924 — Critical (CVSS 9.1): NextAuth.js is a complete open source authentication solution for Next.js applications. `next-auth` users who are using…
- CVE-2023-27490 — High (CVSS 8.1): NextAuth.js is an open source authentication solution for Next.js applications. `next-auth` applications using OAuth…
- CVE-2022-31093 — High (CVSS 7.5): NextAuth.js is a complete open source authentication solution for Next.js applications. In affected versions an…
- CVE-2022-39263 — Medium (CVSS 6.8): `@next-auth/upstash-redis-adapter` is the Upstash Redis adapter for NextAuth.js, which provides authentication for…
- CVE-2022-29214 — Medium (CVSS 6.1): NextAuth.js (next-auth) is am open source authentication solution for Next.js applications. Prior to versions 3.29.3…
- CVE-2022-24858 — Medium (CVSS 6.1): next-auth v3 users before version 3.29.2 are impacted. next-auth version 4 users before version 4.3.2 are also…
All CVEs affecting Nextauth.js Next-auth →
Other CWE-79 (Cross-site Scripting (XSS)) vulnerabilities
- CVE-2025-49410 — Critical (CVSS 10.0): Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') vulnerability in Imran Emu TC…
- CVE-2024-47875 — Critical (CVSS 10.0): DOMPurify is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG. DOMpurify was vulnerable to…
- CVE-2024-6886 — Critical (CVSS 10.0): Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') vulnerability in Gitea…
- CVE-2023-45144 — Critical (CVSS 10.0): com.xwiki.identity-oauth:identity-oauth-ui is a package to aid in building identity and service providers based on…
- CVE-2023-45138 — Critical (CVSS 10.0): Change Request is an pplication allowing users to request changes on a wiki without publishing the changes directly.…
- CVE-2022-4361 — Critical (CVSS 10.0): Keycloak, an open-source identity and access management solution, has a cross-site scripting (XSS) vulnerability in the…
Browse all CWE-79 (Cross-site Scripting (XSS)) vulnerabilities →