Improper handling of email input in next-auth
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Cross-site scripting
- Confidentiality · integrity · availability
- Low · Low · Low
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub. Impact type from CWE-79.
Summary
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- No
- Technical impact
- Partial
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 3.29.8; 4.0.0 to before 4.9.0 | 3.29.8, 4.9.0 | Patch available | CNA |
| — | next-auth (npm) | before 3.29.8 | 3.29.8 | Patch available | GHSA-pgjx-7f9g-9463 |
| — | next-auth (npm) | 4.0.0 to before 4.9.0 | 4.9.0 | Patch available | GHSA-pgjx-7f9g-9463 |
- next-auth Vendornextauthjs Affected before 3.29.8; 4.0.0 to before 4.9.0 Fixed in 3.29.8, 4.9.0 Patch available CNA
- next-auth (npm) Vendor— Affected before 3.29.8 Fixed in 3.29.8 Patch available GHSA-pgjx-7f9g-9463
- next-auth (npm) Vendor— Affected 4.0.0 to before 4.9.0 Fixed in 4.9.0 Patch available GHSA-pgjx-7f9g-9463
CPE configurations NVD · 1
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:nextauth.js:next-auth:*:*:*:*:*:node.js:*:* | before 3.29.8; 4.0.0 to before 4.9.0 | Vulnerable | nextauthjs |
- cpe:2.3:a:nextauth.js:next-auth:*:*:*:*:*:node.js:*:* Versions before 3.29.8; 4.0.0 to before 4.9.0 Vulnerable ·nextauthjs
Remediation
- Fix · CNA next-auth (nextauthjs) Fixed in 3.29.8, 4.9.0
- Fix · GHSA-pgjx-7f9g-9463 next-auth (npm) Fixed in 3.29.8 Advisory →
- Fix · GHSA-pgjx-7f9g-9463 next-auth (npm) Fixed in 4.9.0 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2022-31127
- 2026-10-03 Alias added: GHSA-pgjx-7f9g-9463
References
Advisory 4
More nextauthjs Next-auth vulnerabilities
- 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-2023-12218 Missing proper state, nonce and PKCE checks for OAuth authentication in next-auth CVSS 3.1HIGH 8.8
- 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-2022-31127 · CVE Program
- CVE-2022-31127 · NVD
- FIRST EPSS
- GHSA-pgjx-7f9g-9463 · 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