
Cloud Vulnerability DB
A community-led vulnerabilities database
CVE-2025-61928 is a critical authentication bypass vulnerability in the Better Auth library for TypeScript, affecting the API key creation and update endpoints. Unauthenticated attackers can create or modify API keys for any user by supplying a victim's user ID in the request body, effectively bypassing all authentication checks. The vulnerability affects Better Auth versions prior to 1.3.26 and was disclosed on October 8–9, 2025. It carries a CVSS v4.0 base score of 9.3 (Critical) and a CVSS v3.1 base score of 8.6 (High) (GitHub Advisory, Red Hat CVE).
The root cause is a logic flaw in the user-derivation fallback within the API key creation and update route handlers, classified as CWE-285 (Improper Authorization) and CWE-306 (Missing Authentication for Critical Function). When no session exists, the handler evaluates session?.user ?? (authRequired ? null : { id: ctx.body.userId }), where authRequired becomes false if userId is present in the request body — allowing attacker-controlled input to populate the user context. Server-side field validation (lines 280–295) only executes when authRequired is true, so privileged fields are not protected and the malicious payload is accepted without any additional authentication before the database operation. The fix in commit 5560850 changes the logic so that authRequired is always true when a request or headers are present, and adds an explicit check that a session user cannot create keys for a different userId (GitHub Advisory, GitHub Commit).
Successful exploitation allows an unauthenticated attacker to generate or modify API keys for any user in the application, granting complete authenticated access as the targeted user. Depending on the victim's privileges, this can lead to full account compromise, unauthorized access to sensitive user data, and broader application takeover. The vulnerability affects confidentiality, integrity, and availability of the targeted user's resources, and could enable lateral movement across the application if high-privilege accounts are targeted (GitHub Advisory, Feedly).
No public proof-of-concept exploit code or evidence of in-the-wild exploitation has been reported as of the time of disclosure (Feedly). The EPSS score is approximately 0.125%, indicating a currently low probability of exploitation in the near term. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. However, the attack requires no authentication, no user interaction, and no special preconditions beyond network access to the target application's API endpoint, making it trivially exploitable if discovered (GitHub Advisory).
/api/auth/api-key/create endpoint./api/auth/api-key/create without any session cookie or authentication header, including the victim's user ID in the request body: {"userId": "<victim-user-id>"}.userId is present in the body, the handler sets authRequired to false and populates the user context with the attacker-supplied ID, bypassing all authentication checks./api/auth/api-key/create or /api/auth/api-key/update without a valid session cookie or Authorization header; requests containing a userId field in the body from unauthenticated sources.Upgrade Better Auth to version 1.3.26 or later, which contains the patch that corrects the authentication logic in the API key creation and update routes (GitHub Advisory, GitHub Commit). As immediate remediation steps: audit all existing API keys in the database for unauthorized entries and revoke any suspicious keys; review application logs for unauthenticated requests to the API key endpoints; and rotate API keys for high-privilege users as a precaution. No configuration-based workaround is available — upgrading to the patched version is the only reliable fix.
The vulnerability received notable community attention on Reddit (r/netsec and r/javascript), Hacker News, Bluesky, and Mastodon, with discussions highlighting the severity of the authentication bypass and its potential for account takeover (Reddit r/netsec, Hacker News). Security media outlets including The Hacker News, SecurityOnline, eSecurity Planet, and CyberSecurityNews covered the disclosure, emphasizing the critical nature of the flaw and urging immediate patching (The Hacker News, eSecurity Planet). Emerging Threats published detection rules for the vulnerability in their October 21, 2025 ruleset update (Emerging Threats). Risky Biz also mentioned the flaw in their security bulletin (Risky Biz).
Source: This report was generated using AI
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."