Skip to main content
Live Webinar with SANS (June 25)— Agentic CTI Automation for Fun & ProfitRegister Free
Mallory
CriticalPublic exploit

Authentication bypass in Better Auth API keys plugin

IdentifiersCVE-2025-61928CWE-639

CVE-2025-61928 is an authentication and authorization logic flaw in Better Auth's API keys plugin affecting versions prior to 1.3.26. The vulnerable create and update API key routes accept a user-supplied userId in the request body and incorrectly derive user context with logic equivalent to session?.user ?? (authRequired ? null : { id: ctx.body.userId }). When no valid session exists but userId is present, authRequired becomes false and the request is processed using an attacker-controlled user object. Because server-only field validation is only executed when authRequired is true, privileged fields can also bypass intended validation. No additional authentication check occurs before the database operation, allowing unauthenticated attackers to create or modify API keys for arbitrary users.

Share:
For your environment

Are you exposed to this one?

Mallory correlates every CVE against your assets, your vendors, and active adversary campaigns. Know which vulnerabilities matter for you, not just which ones are loud.

ANALYST BRIEF

Impact, mitigation & remediation

What it means. What to do now. Patch path, mitigations, and the assume-compromise checklist.

Impact

What an attacker gets, and what they’ve been doing with it.

Successful exploitation enables full account compromise for any targeted Better Auth user reachable through the affected API key routes. An unauthenticated attacker can mint a new API key for a victim user or modify API key records associated with that user, then immediately authenticate as the victim via the generated key. Impact depends on victim privileges but can include unauthorized access to protected application functionality, access to or modification of user data, abuse of administrative capabilities, and downstream compromise of applications relying on Better Auth for identity enforcement.

Mitigation

If you can’t patch tonight, do this now.

If immediate upgrade is not possible, disable the affected API key create/update endpoints or the API keys plugin where feasible. Block unauthenticated access to api/auth/api-key/create and corresponding update routes at the application, gateway, or reverse-proxy layer. Reject any client-supplied userId for identity selection on these endpoints and require identity to come only from validated session state. Monitor for anomalous API key creation/update activity, especially requests lacking a valid session but containing userId, and revoke suspicious keys. Additional compensating controls include WAF/API gateway rules, strict route-level authentication enforcement, and temporary restriction of API key management to trusted administrative workflows.

Remediation

Patch, then assume compromise.

Upgrade Better Auth to version 1.3.26 or later, which contains the vendor patch for this issue. Review the API keys plugin create and update route logic to ensure user identity is derived exclusively from an authenticated session or other trusted server-side context, not from client-controlled request fields. Enforce server-side validation of privileged or server-only fields regardless of authentication branch, and verify that API key creation and update operations perform explicit authorization checks before database writes. After patching, rotate and reissue API keys that may have been exposed or fraudulently created, and audit logs for unauthorized API key creation or modification events.
PUBLIC EXPLOITS

Exploits

No public exploits tracked yet. Mallory keeps watching.

VALID 0 / 0 TOTALView more in app

No public exploit code observed for this vulnerability.

What this page doesn’t show

The version that knows your environment.

This page is what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which adversaries are exploiting it right now, which detections to deploy, and what to do tonight.
Exposure mapping

Query your assets running an affected version, and investigate the blast radius.

Threat actor evidence

Every observed campaign linking this CVE to a named adversary.

Associated malware

Malware families riding this exploit, with evidence and IOCs.

Detection signatures

YARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.

Vendor-by-vendor mapping

Cross-references every affected SKU, including bundled OEM variants.

Social activity13

Community discussion across Reddit, Mastodon, and other social sources.