Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

GHSA-7w99-5wm4-3g79: @better-auth/oauth-provider's OAuth authorization-code grant allows concurrent redemption when two token requests race the find-then-delete primitive

0
High
Published: 07/07/2026 (07/07/2026, 20:56:35 UTC)
Source: GCVE Database
Product: @better-auth/oauth-provider

Description

A race condition in @better-auth/oauth-provider versions >=1.6.0 and <1.6.11 allows concurrent redemption of the same OAuth authorization code. This occurs because the token endpoint uses a non-atomic find-then-delete operation to consume single-use authorization codes, enabling multiple token sets to be issued from one code. The issue also affects legacy plugins in better-auth versions >=1.4.8-beta.7 and <1.6.0. The vulnerability violates RFC 6749's single-use code requirement and can lead to multiple valid tokens from a single authorization code.

CVSS v4.0

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
None
User Interaction
Passive
Vuln. Confidentiality
High
Vuln. Integrity
High
Vuln. Availability
None
Subsq. Confidentiality
None
Subsq. Integrity
None
Subsq. Availability
None
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N

Affected software

npmghsa
@better-auth/oauth-provider
Affected versions
>=1.6.0 <1.6.11
npmghsa
better-auth
Affected versions
<1.6.11

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 07/08/2026, 13:44:18 UTC

Technical Analysis

The OAuth provider's POST /oauth2/token endpoint for the authorization_code grant uses a non-atomic find-then-delete sequence to redeem single-use authorization codes. When two concurrent requests race, both can read the code before either deletes it, resulting in both requests successfully minting access, refresh, and ID tokens. This breaks the single-use guarantee mandated by RFC 6749 §4.1.2. The root cause is that the deletion primitive discards the row count, preventing detection of concurrent claims. The fix, introduced in version 1.6.11, replaces this with an atomic claimVerificationByIdentifier primitive that atomically claims and deletes the verification row, ensuring only the first request succeeds and others receive an invalid_grant error. Legacy plugins oidc-provider and mcp share this vulnerability and are fixed in better-auth 1.6.11. Workarounds at network, database, or application layers exist but do not fully resolve the issue without upgrading.

Potential Impact

Multiple independent token sets (access, refresh, and ID tokens) can be issued from a single authorization code, violating the OAuth 2.0 specification's single-use code requirement. This allows bypassing detection mechanisms that rely on single redemption, potentially enabling token duplication and unauthorized token use within the original user's authorization scope. The vulnerability affects both the main OAuth provider and legacy plugins, increasing the attack surface for affected deployments.

Mitigation Recommendations

An official fix is available by upgrading to @better-auth/oauth-provider version 1.6.11 or later. For legacy plugin users, upgrade better-auth to version 1.6.11 or later. No workaround fully closes the vulnerability without applying the patch. Temporary mitigations include deploying a reverse proxy that serializes token requests by authorization code, adding database uniqueness constraints on token issuance (if feasible), or implementing custom adapter hooks to detect duplicate claims; however, these are fragile and not recommended as sole solutions. Upgrading remains the only reliable remediation.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Gcve Source
db.gcve.eu
Osv Id
GHSA-7w99-5wm4-3g79
Osv Schema Version
1.4.0
Aliases
["CVE-2026-53518"]
Ecosystems
["npm"]
Database Specific Severity
HIGH
Cvss Version
4.0

Threat ID: 6a4e4ef7c9d9e3dbe328cbfc

Added to database: 07/08/2026, 13:21:59 UTC

Last enriched: 07/08/2026, 13:44:18 UTC

Last updated: 07/08/2026, 15:01:35 UTC

Views: 3

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses