NextAuth.js: OAuth state, nonce, and PKCE check cookies are not bound to the provider that created them
nextauthjs next-auth · @auth core
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| @auth/core npm |
|
|
| next-auth npm |
|
|
nextauthjs next-auth · @auth core
| Product | Affected | Fixed in |
|---|---|---|
| @auth/core npm |
|
|
| next-auth npm |
|
|
NextAuth.js provides authentication for Next.js. Prior to@auth/core 0.41.3 and next-auth 4.24.15 and 5.0.0-beta.32, Auth.js stores the OAuth/OIDC anti-CSRF checks state, nonce, and the PKCE verifier in global cookies that are not bound to the provider that created them. On callback, a check value minted during a sign-in started with one provider can satisfy the callback for a different provider because the stored cookie is not verified against the callback provider's identity, including the provider ID, issuer, client ID, or redirect URI. In a multi-provider application that permits account linking while logged in, when one provider's authorization request is observable and a target provider callback can be satisfied without a PKCE verifier, an attacker can lure a victim into starting a legitimate same-origin flow and link the attacker's target-provider account to the victim's Auth.js user. The linked provider grants the attacker persistent sign-in to the victim's account, while cross-site request forgery alone is insufficient. This issue is fixed in @auth/core 0.41.3 and next-auth 4.24.15 and 5.0.0-beta.32.
From the CVE record · GitHub_M
Auth.js stores OAuth/OIDC anti-CSRF values in cookies that are not bound to the provider that created them. In a multi-provider application that allows account linking, an attacker can lure a logged-in victim into starting a legitimate sign-in flow and link the attacker's provider account to the victim's account. This requires an observable authorization request from one provider and a target-provider callback that can succeed without a PKCE verifier; the linked account then gives the attacker persistent sign-in access.
Check applications using @auth/core before 0.41.3 or next-auth before 4.24.15, or next-auth 5.0.0-beta.1 through beta.31.