Better Auth: Unauthenticated API key creation through api-key plugin
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Attack requirements
- None
- Impact type
- Security bypass
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 4.0 · CNA. Fix status from CNA and GitHub. Impact type from CWE-285.
Summary
Better Auth is an authentication and authorization library for TypeScript. In versions prior to 1.3.26, unauthenticated attackers can create or modify API keys for any user by passing that user's id in the request body to the `api/auth/api-key/create` route. `session?.user ?? (authRequired ? null : { id: ctx.body.userId })`. When no session exists but `userId` is present in the request body, `authRequired` becomes false and the user object is set to the attacker-controlled ID. Server-only field validation only executes when `authRequired` is true (lines 280-295), allowing attackers to set privileged fields. No additional authentication occurs before the database operation, so the malicious payload is accepted. The same pattern exists in the update endpoint. This is a critical authentication bypass enabling full an unauthenticated attacker can generate an API key for any user and immediately gain complete authenticated access. This allows the attacker to perform any action as the victim user using the api key, potentially compromise the user data and the application depending on the victim's privileges. Version 1.3.26 contains a patch for the issue.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- Yes
- Technical impact
- Total
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| better-auth | better-auth | before 1.3.26 | 1.3.26 | Patch available | CNA |
| — | better-auth (npm) | before 1.3.26 | 1.3.26 | Patch available | GHSA-99h5-pjcv-gr6v |
- better-auth Vendorbetter-auth Affected before 1.3.26 Fixed in 1.3.26 Patch available CNA
- better-auth (npm) Vendor— Affected before 1.3.26 Fixed in 1.3.26 Patch available GHSA-99h5-pjcv-gr6v
CPE names Threatist (inferred) · 1
Inferred from how NVD named this product before; not given by a source.
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:better-auth:better_auth:*:*:*:*:*:*:*:* | — | — | better-auth |
- cpe:2.3:a:better-auth:better_auth:*:*:*:*:*:*:*:* Versions — — ·better-auth
Remediation
- Fix · CNA better-auth (better-auth) Fixed in 1.3.26
- Fix · GHSA-99h5-pjcv-gr6v better-auth (npm) Fixed in 1.3.26 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2025-61928
- 2026-10-03 Alias added: GHSA-99h5-pjcv-gr6v
References
More better-auth vulnerabilities
- TI-2026-47627 better-auth SCIM 1.5.0 before 1.7.0-beta.4 Authorization Bypass CVSS 4.0HIGH 8.7
- TI-2025-20000 Beter Auth has an Open Redirect via Scheme-Less Callback Parameter CVSS 4.0MEDIUM 6.9
- TI-2026-13066 better-auth better-icons scan_project_icons/sync_icon path traversal CVSS 4.0MEDIUM 4.8
- TI-2026-79320 OAuth state accepted as Magic Link token in Better Auth CVSS 3.1CRITICAL 9.1
- TI-2026-74552 Authentication bypass in Better Auth Magic Link verification CVSS 4.0CRITICAL 9.3
- TI-2026-84923 Unchecked state signing in @better-auth/expo enables account takeover CVSS 3.1CRITICAL 9.1
Sources
- CVE-2025-61928 · CVE Program
- CVE-2025-61928 · NVD
- FIRST EPSS
- GHSA-99h5-pjcv-gr6v · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences