fix(deps): update dependency next-auth to v4.24.5 [security] #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
4.18.9->4.24.5GitHub Vulnerability Alerts
CVE-2023-27490
Impact
next-authapplications using OAuth provider versions beforev4.20.1are affected.A bad actor who can spy on the victim's network or 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.
As an example, an attack can happen in the following scenario.
next-authsite. For example https://next-auth-example.vercel.app/next-authsets thecheckscookies according to how the OAuth provider is configured. In this case,stateandpkceare set by default for the Google Provider.The attacker intercepts the returned authorization URL, strips away the OAuth check (nonce, state, pkce), and returns the URL without the check to the victim's browser. For example:
From
https://accounts.google.com/o/oauth2/v2/auth/oauthchooseaccount?client_id=client_id&scope=openid%20email%20profile&response_type=code&redirect_uri=https%3A%2F%2Fnext-auth-example.vercel.app%2Fapi%2Fauth%2Fcallback%2Fgoogle&state=state&code_challenge=code_challenge&code_challenge_method=S256&service=lso&o2v=2&flowName=GeneralOAuthFlowto
https://accounts.google.com/o/oauth2/v2/auth/oauthchooseaccount?client_id=client_id&scope=openid%20email%20profile&response_type=code&redirect_uri=https%3A%2F%2Fnext-auth-example.vercel.app%2Fapi%2Fauth%2Fcallback%2Fgoogle&service=lso&o2v=2&flowName=GeneralOAuthFlow.Notice the parameters
state,code_challengeandcode_verifierare removed from the victim's address bar.The victim attempts to log in using their OAuth account.
The Authorization Server logs the victim in and calls back to the
next-authapi/auth/callback/:providerIdendpoint.5.1. The attacker intercepts and logs this callback URL for later use.
5.2.
next-authchecks the callback call from OAuth Authorization Server (doesn't have checks) and compares the checks with the cookies set (has checks) at step 2. This check will fail, resulting in the victim isn't logged in. However, at this step, the Authorization Server has already accepted the victim's request to log in and generated/sent acodein the URL.The attacker now has an authorization URL with the
codethat the AS will exchange for validaccess_token/id_tokenand can log in as the victim automatically. They can open a new browser window and paste in the URL logged at step 5.1 and log in as the victim.Patches
We patched the vulnerability in
next-authv4.20.1To upgrade, run one of the following:
Workarounds
Upgrading to
latestis the recommended way to fix this issue. However, using Advanced Initialization, developers can manually check the callback request forstate,pkce, andnonceagainst the provider configuration, and abort the sign-in process if there is a mismatch. Check out the source code for help.References
checksprovider configCVE-2023-48309
Impact
next-authapplications 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-tokencookie 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-authv4.24.5. To upgrade, run one of the following:Workarounds
Upgrading to
latestis the recommended way to fix this issue. However, using a custom authorization callback for Middleware, developers can manually do a basic authentication:References
Release Notes
nextauthjs/next-auth (next-auth)
v4.24.5Compare Source
Bugfixes
v4.24.4Compare Source
Bugfixes
v4.24.3Compare Source
Bugfixes
v4.24.2Compare Source
Bugfixes
v4.24.1Compare Source
Bugfixes
v4.24.0Compare Source
Features
v4.23.2Compare Source
Bugfixes
redirect: falsefor route handler (#8775) (27b2519)d813c00)?from signIn URL (#8466)Other
v4.23.1Compare Source
Bugfixes
next-auth/adapters(20c3fe3)defaultsubmodules export inpackage.json(#8330)v4.23.0Compare Source
Features
5a8aa2e)Bugfixes
05ff6ae)v4.22.5Compare Source
Bugfixes
next-auth/adapter&@auth/core/adapters(nextauthjs/next-auth@3b0128c)Other
v4.22.4Compare Source
Bugfixes
465644f)getServerSession(#8108)res.end()in api handler (#8244)Other
getServerSessionunstable_getServerSessionv4.22.3Compare Source
Full Changelog: https://github.com/nextauthjs/next-auth/compare/[email protected]@4.22.3
v4.22.2Compare Source
Bugfixes
nodemailer/required types (#7950) (f48eb04)bd37c55)169a523)Other
v4.22.1Bugfixes
instanceof Requestcheck fails (#7303)Other
b481048)a220245)next-authfromv4tomain(#7265)v4.21.1Compare Source
Bugfixes
sessioncallback type changes (#7136) (ec8a343)v4.21.0Compare Source
Features
Bugfixes
8aa1789)86d031f)idinupdateUseras always defined (319f2ce)Other
v4.20.1Compare Source
Full Changelog: https://github.com/nextauthjs/next-auth/compare/[email protected]@4.20.1
v4.20.0Compare Source
What's Changed
getServerSidePropsby @ChinonsoIg in https://github.com/nextauthjs/next-auth/pull/6589enginesrequirement onopenid-clientby @balazsorban44 in https://github.com/nextauthjs/next-auth/pull/6654NEXTAUTH_URL_INTERNALby @ThangHuuVu in https://github.com/nextauthjs/next-auth/pull/6814New Contributors
Full Changelog: https://github.com/nextauthjs/next-auth/compare/[email protected]@4.20.0
v4.19.2Compare Source
What's Changed
Full Changelog: https://github.com/nextauthjs/next-auth/compare/[email protected]@4.19.2
v4.19.1Compare Source
What's Changed
unstablenote. by @OrJDev in https://github.com/nextauthjs/next-auth/pull/6537unstable_getServerSessionby @joulev in https://github.com/nextauthjs/next-auth/pull/6560New Contributors
Full Changelog: https://github.com/nextauthjs/next-auth/compare/[email protected]@4.19.1
v4.19.0Compare Source
What's Changed
oauth_token_secretin https://github.com/nextauthjs/next-auth/pull/6534unstable_prefixgetServerSessionin https://github.com/nextauthjs/next-auth/pull/6535generateSessionTokenawaitable in https://github.com/nextauthjs/next-auth/pull/6536Full Changelog: https://github.com/nextauthjs/next-auth/compare/[email protected]@4.19.0
v4.18.10Compare Source
Full Changelog: https://github.com/nextauthjs/next-auth/compare/[email protected]@4.18.10
Configuration
📅 Schedule: Branch creation - "" in timezone Europe/Paris, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Never, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.