fix(deps): update dependency next-auth to v4.20.1 [security] #114
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.19.2
->4.20.1
GitHub Vulnerability Alerts
CVE-2023-27490
Impact
next-auth
applications using OAuth provider versions beforev4.20.1
are 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-auth
site. For example https://next-auth-example.vercel.app/next-auth
sets thechecks
cookies according to how the OAuth provider is configured. In this case,state
andpkce
are 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=GeneralOAuthFlow
to
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_challenge
andcode_verifier
are 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-auth
api/auth/callback/:providerId
endpoint.5.1. The attacker intercepts and logs this callback URL for later use.
5.2.
next-auth
checks 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 acode
in the URL.The attacker now has an authorization URL with the
code
that the AS will exchange for validaccess_token
/id_token
and 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-auth
v4.20.1
To upgrade, run one of the following:
Workarounds
Upgrading to
latest
is the recommended way to fix this issue. However, using Advanced Initialization, developers can manually check the callback request forstate
,pkce
, andnonce
against the provider configuration, and abort the sign-in process if there is a mismatch. Check out the source code for help.References
checks
provider configRelease Notes
nextauthjs/next-auth
v4.20.1
Compare Source
Full Changelog: https://github.com/nextauthjs/next-auth/compare/next-auth@4.20.0...next-auth@4.20.1
v4.20.0
Compare Source
What's Changed
getServerSideProps
by @ChinonsoIg in https://github.com/nextauthjs/next-auth/pull/6589engines
requirement onopenid-client
by @balazsorban44 in https://github.com/nextauthjs/next-auth/pull/6654NEXTAUTH_URL_INTERNAL
by @ThangHuuVu in https://github.com/nextauthjs/next-auth/pull/6814New Contributors
Full Changelog: https://github.com/nextauthjs/next-auth/compare/next-auth@4.19.2...next-auth@4.20.0
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.