highCVSS 8.1Vulnerability

CVE-2026-53518

### Am I affected? Users are affected if all of the following are true: - Their project depends on `@better-auth/oauth-provider` at a version `>= 1.6.0, < 1.6.11`, or uses the embedded plugin in `better-auth >= 1.4.8-beta.7, < 1.6.0`, or enables the legacy `oidc-provider` or `mcp` plugins from `better-auth/plugins`. - Their application exposes `/api/auth/oauth2/token` (or the legacy plugins' `/oauth2/token` and `/mcp/token`) as a token endpoint to OAuth/OIDC clients, including internal MCP clients (Claude Desktop, custom MCP tool callers, AI agents). - Their application has not implemented an external mitigation: a load-balancer-level idempotency cache keyed by `code`, a database trigger that rejects duplicate token issuance for the same authorization code, or a custom adapter override that performs an atomic compare-and-delete. Fix: 1. Upgrade to `@better-auth/[email protected]` or later. If developers use the legacy plugin paths from `better-auth/plugins`, upgrade `better-auth` to `1.6.11` or later. 2. If developers cannot upgrade, see workarounds below. ### Summary The OAuth provider's `POST /oauth2/token` endpoint, on the `authorization_code` grant, redeems a single-use authorization code through a non-atomic find-then-delete sequence. Two concurrent requests with the same `code` value both pass the read step before either delete completes, then both proceed to PKCE verification and `createUserTokens`. Each surviving request mints a fresh access token, refresh token, and id token. RFC 6749 §4.1.2 requires authorization codes to be single-use; this primitive does not enforce that under concurrency. ### Details The same architectural primitive (find a single-use verification row, then delete it, then trust the row to authorize) is used in 20 other call sites across the codebase. The deletion primitive returns `Promise<void>`, discarding the row count surfaced by `adapter.deleteMany`, so no call site can detect "another caller already claimed this row".

Properties

summary
@better-auth/oauth-provider's OAuth authorization-code grant allows concurrent redemption when two token requests race the find-then-delete primitive
severity
high
epss_score
0.00229
cvss_score
8.1
ghsa_published
2026-07-07T20:56:35Z
source_url
https://github.com/advisories/GHSA-7w99-5wm4-3g79
ghsa_updated
2026-07-07T20:56:35Z
ghsa_id
GHSA-7w99-5wm4-3g79
cve_id
CVE-2026-53518
cvss_vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
is_ghsa_only
false
epss_percentile
0.14002

Related Entities (9)

ENRICHED_BY (1)

[Source]FIRST EPSS

HAS_WEAKNESS (3)

[Weakness]Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
[Weakness]Authentication Bypass by Capture-replay
[Weakness]Time-of-check Time-of-use (TOCTOU) Race Condition

REPORTED_BY (1)

[Source]GitHub Advisory Database

VULNERABLE_TO (2)

[Software]npm/@better-auth/oauth-provider
[Software]npm/better-auth

AFFECTS (2)

[Software]npm/better-auth
[Software]npm/@better-auth/oauth-provider

Explore deeper with Ninja Signal's threat intelligence graph

CVE-2026-53518 (CVSS 8.1) — Ninja Signal Threat Intelligence | Ninja Signal