Better Auth OAuth Provider: Race Condition in Authorization Code Exchange Enables Multi-Use Code Redemption
better-auth
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| @better-auth/oauth-provider npm |
|
|
| better-auth npm |
|
|
better-auth
| Product | Affected | Fixed in |
|---|---|---|
| @better-auth/oauth-provider npm |
|
|
| better-auth npm |
|
|
Better Auth is an authentication and authorization library for TypeScript. From 1.6.0 until 1.6.11, the @better-auth/oauth-provider POST /oauth2/token endpoint for the authorization_code grant redeems a single-use authorization code through a non-atomic find-then-delete sequence, allowing two concurrent requests to pass the read step and mint independent access tokens, refresh tokens, and ID tokens; legacy /oauth2/token and /mcp/token paths in oidc-provider and mcp plugins share the same primitive. This issue is fixed in version 1.6.11.
From the CVE record · GitHub_M
The authorization-code token endpoint in @better-auth/oauth-provider uses a non-atomic find-then-delete operation to redeem single-use codes; legacy token paths in the oidc-provider and mcp plugins share the same behavior. Two concurrent requests using the same code can each mint access, refresh, and ID tokens.
Check deployments using npm @better-auth/oauth-provider versions >=1.6.0 and <1.6.11 or npm better-auth versions <1.6.11.