Skip to content

chore(deps): update dependency next-auth to v4.24.12 [security]#259

Open
renovate[bot] wants to merge 1 commit intodevelopfrom
renovate/npm-next-auth-vulnerability
Open

chore(deps): update dependency next-auth to v4.24.12 [security]#259
renovate[bot] wants to merge 1 commit intodevelopfrom
renovate/npm-next-auth-vulnerability

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Nov 21, 2023

This PR contains the following updates:

Package Change Age Confidence
next-auth (source) 4.22.14.24.12 age confidence

GitHub Vulnerability Alerts

CVE-2023-48309

Impact

next-auth applications prior to version 4.24.5 that rely on the default Middleware authorization are affected.

A bad actor could create an empty/mock user, by getting hold of a NextAuth.js-issued JWT from an interrupted OAuth sign-in flow (state, PKCE or nonce).

Manually overriding the next-auth.session-token cookie value with this non-related JWT would let the user simulate a logged in user, albeit having no user information associated with it. (The only property on this user is an opaque randomly generated string).

This vulnerability does not give access to other users' data, neither to resources that require proper authorization via scopes or other means. The created mock user has no information associated with it (ie. no name, email, access_token, etc.)

This vulnerability can be exploited by bad actors to peek at logged in user states (e.g. dashboard layout).

Note: Regardless of the vulnerability, the existence of a NextAuth.js session state can provide simple authentication, but not authorization in your applications. For role-based access control, you can check out our guide.

Patches

We patched the vulnerability in next-auth v4.24.5. To upgrade, run one of the following:

npm i next-auth@latest
yarn add next-auth@latest
pnpm add next-auth@latest

Workarounds

Upgrading to latest is the recommended way to fix this issue. However, using a custom authorization callback for Middleware, developers can manually do a basic authentication:

// middleware.ts
import { withAuth } from "next-auth/middleware"

export default withAuth(/*your middleware function*/, {
  // checking the existence of any property - besides `value` which might be a random string - on the `token` object is sufficient to prevent this vulnerability
  callbacks: { authorized: ({ token }) => !!token?.email }
})

References

GHSA-5jpx-9hw9-2fx4

Summary

NextAuth.js's email sign-in can be forced to deliver authentication emails to an attacker-controlled mailbox due to a bug in nodemailer's address parser used by the project (fixed in nodemailer v7.0.7). A crafted input such as:

"e@attacker.com"@​victim.com

is parsed incorrectly and results in the message being delivered to e@attacker.com (attacker) instead of "<e@attacker.com>@&#8203;victim.com" (the intended recipient at victim.com) in violation of RFC 5321/5322 semantics. This allows an attacker to receive login/verification links or other sensitive emails intended for the victim.

Affected NextAuthjs Version

≤ Version Afftected
4.24.11 Yes
5.0.0-beta.29 Yes

POC

Example Setup showing misdelivery of email

import NextAuth from "next-auth"
import Nodemailer from "next-auth/providers/nodemailer"
import { PrismaAdapter } from "@&#8203;auth/prisma-adapter"
import { prisma } from "@&#8203;/lib/prisma"

export const { handlers, auth, signIn, signOut } = NextAuth({
  adapter: PrismaAdapter(prisma),
  providers: [
    Nodemailer({
      server: {
        host: "127.0.0.1",
        port: 1025,
        ...
      },
      from: "noreply@authjs.dev",
    }),
  ],
  pages: {
    signIn: '/auth/signin',
    verifyRequest: '/auth/verify-request',
  },
})
POST /api/auth/signin/nodemailer HTTP/1.1
Accept-Encoding: gzip, deflate, br, zstd
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 176
DNT: 1
Host: localhost:3000
Origin: http://localhost:3000
Pragma: no-cache
Referer: http://localhost:3000/auth/signin
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36
accept: */*
accept-language: en-US,en;q=0.9,ta;q=0.8
content-type: application/x-www-form-urlencoded
sec-ch-ua: "Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Linux"
x-auth-return-redirect: 1

email=%22e%40attacker.coccm%22%40victim.com&csrfToken=90f5e6f48ab577ab011f212011862dcfe546459c23764cf891aab2d176f8d77a&callbackUrl=http%3A%2F%2Flocalhost%3A3000%2Fauth%2Fsignin
Screenshot from 2025-10-25 21-15-25 Screenshot from 2025-10-25 21-14-47

Mitigation

Update to nodemailer 7.0.7

Credits

https://zeropath.com/ Helped identify this security issue


Release Notes

nextauthjs/next-auth (next-auth)

v4.24.12

Compare Source

v4.24.11

Compare Source

v4.24.10

Compare Source

What's Changed

Full Changelog: https://github.com/nextauthjs/next-auth/compare/next-auth@4.24.9...next-auth@4.24.10

v4.24.9

Compare Source

What's Changed

New Contributors

Full Changelog: https://github.com/nextauthjs/next-auth/compare/next-auth@4.24.8...next-auth@4.24.9

v4.24.8

Compare Source

What's Changed

New Contributors

Full Changelog: https://github.com/nextauthjs/next-auth/compare/next-auth@4.24.7...next-auth@4.24.8

v4.24.7

Compare Source

Others

v4.24.6

Compare Source

Bugfixes

v4.24.5

Compare Source

Bugfixes

  • differentiate between issued JWTs

v4.24.4

Compare Source

Bugfixes

  • allow Next.js 14 as peer dependency

v4.24.3

Compare Source

Bugfixes

  • css build error

v4.24.2

Compare Source

Bugfixes

  • css build error

v4.24.1

Compare Source

Bugfixes

  • css build error

v4.24.0

Compare Source

Features

v4.23.2

Compare Source

Bugfixes

  • next: returns correct status for signing in with redirect: false for route handler (#​8775) (27b2519)
  • ts: fix typo (d813c00)
  • remove trailing ? from signIn URL (#​8466)

Other

  • update security policy link

v4.23.1

Compare Source

Bugfixes

  • ts: correctly expose next-auth/adapters (20c3fe3)
  • use default submodules export in package.json (#​8330)

v4.23.0

Compare Source

Features

  • providers: add Passage by 1Password (5a8aa2e)

Bugfixes

  • ts: correctly export submodule types (05ff6ae)
  • sort cookie chunks correctly (#​8284)

v4.22.5

Compare Source

Bugfixes

  • ts: match next-auth/adapter & @auth/core/adapters (3b0128c)

Other

  • docs: amplify note

v4.22.4

Compare Source

Bugfixes

Other

  • docs: fixing broken link in documentation (#​8208)
  • docs: clarify getServerSession
  • docs: move unstable_getServerSession
  • docs: Typo fixed (#​8206)
  • docs(providers): mention HTTP-based Email guide (#​8214)
  • docs: Update object key "email" to "username" (#​8113)
  • doc: Add a guide on sending magic links to existing users only (#​7663)
  • docs: Update refresh-token-rotation.md - fix example client code filename (#​8088)
  • docs(providers): updated docs with missing account attribute (#​8084)

v4.22.3

Compare Source

Full Changelog: https://github.com/nextauthjs/next-auth/compare/next-auth@4.22.2...next-auth@4.22.3

v4.22.2

Compare Source

Bugfixes

Other

  • remove unused TS types
  • merge changes back to v4 (#​7430)
  • rephrase

Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot requested a review from a team as a code owner November 21, 2023 04:17
@renovate renovate bot added the dependencies Pull requests that update a dependency file label Nov 21, 2023
@renovate
Copy link
Contributor Author

renovate bot commented Nov 21, 2023

Branch automerge failure

This PR was configured for branch automerge. However, this is not possible, so it has been raised as a PR instead.

@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch 2 times, most recently from 8dd37ca to 4206d8b Compare February 5, 2024 06:52
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch 2 times, most recently from 8b1ba10 to 8c10321 Compare April 6, 2024 02:33
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch 3 times, most recently from 2fc169e to 12a9fea Compare May 13, 2024 08:09
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch 2 times, most recently from f403122 to 39e6e1d Compare May 21, 2024 11:07
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch 4 times, most recently from 740323b to 77cbeb0 Compare June 12, 2024 03:05
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch 3 times, most recently from 7c0dbcc to 84e19b7 Compare June 17, 2024 05:13
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch 2 times, most recently from 78b86ef to ea26f8c Compare June 28, 2024 16:47
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch 2 times, most recently from b5b4c53 to 38472ef Compare July 16, 2024 06:41
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch from 38472ef to bfeb515 Compare October 4, 2024 02:20
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch 4 times, most recently from a6f5fa1 to 42ee590 Compare November 4, 2024 11:36
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch from 42ee590 to 30f5fbc Compare November 5, 2024 04:07
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch from 30f5fbc to 198f19d Compare November 15, 2024 12:45
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch from 198f19d to f16dbf0 Compare February 22, 2025 11:04
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch 2 times, most recently from 8e0ed8a to 55be125 Compare March 10, 2025 07:07
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch 2 times, most recently from 5a4fba6 to dfdfa37 Compare March 25, 2025 16:14
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch 3 times, most recently from e402b2e to cd3de95 Compare April 11, 2025 01:50
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch from cd3de95 to baa509b Compare May 4, 2025 11:26
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch 2 times, most recently from 24f23bb to 7a23eab Compare May 27, 2025 13:45
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch 4 times, most recently from 3dcaee0 to 2a2cdfb Compare June 21, 2025 05:11
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch from 2a2cdfb to 5328d52 Compare June 25, 2025 05:20
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch 2 times, most recently from 3b496e9 to 2da1a24 Compare July 11, 2025 05:10
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch from 2da1a24 to 864a3b2 Compare September 25, 2025 21:37
@renovate renovate bot changed the title fix(deps): update dependency next-auth to v4.24.5 [security] chore(deps): update dependency next-auth to v4.24.5 [security] Sep 25, 2025
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch from 864a3b2 to 40da829 Compare October 23, 2025 06:37
@renovate renovate bot changed the title chore(deps): update dependency next-auth to v4.24.5 [security] chore(deps): update dependency next-auth to v4.24.12 [security] Oct 29, 2025
@renovate renovate bot changed the title chore(deps): update dependency next-auth to v4.24.12 [security] chore(deps): update dependency next-auth to v4.24.5 [security] Oct 31, 2025
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch from 40da829 to 2f17d26 Compare November 21, 2025 15:38
@renovate renovate bot force-pushed the renovate/npm-next-auth-vulnerability branch from 2f17d26 to 93d3054 Compare November 21, 2025 15:58
@renovate renovate bot changed the title chore(deps): update dependency next-auth to v4.24.5 [security] chore(deps): update dependency next-auth to v4.24.12 [security] Dec 5, 2025
@renovate
Copy link
Contributor Author

renovate bot commented Dec 5, 2025

⚠️ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: frontend/package-lock.json
npm warn Unknown env config "store". This will stop working in the next major version of npm.
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: frontend-v2@0.1.0
npm error Found: nodemailer@6.10.1
npm error node_modules/nodemailer
npm error   peerOptional nodemailer@"^6.8.0" from @auth/core@0.34.2
npm error   node_modules/@auth/core
npm error     peerOptional @auth/core@"0.34.2" from next-auth@4.24.12
npm error     node_modules/next-auth
npm error       next-auth@"4.24.12" from the root project
npm error
npm error Could not resolve dependency:
npm error peerOptional nodemailer@"^7.0.7" from next-auth@4.24.12
npm error node_modules/next-auth
npm error   next-auth@"4.24.12" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /runner/cache/others/npm/_logs/2026-02-02T21_16_59_561Z-eresolve-report.txt
npm error A complete log of this run can be found in: /runner/cache/others/npm/_logs/2026-02-02T21_16_59_561Z-debug-0.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants