Skip to content
Account takeover Write-up Intermediate

Better-auth account takeover (CVE-2025-61928) found via ZeroPath

An unauthenticated attacker could create API keys for any user by supplying a userId in the request body, bypassing authentication and server-only field validation. This allowed minting privileged credentials for arbitrary accounts, leading to account takeover.

zeropath.com

Published on zeropath.com

ZeroPath uncovered an unauthenticated API key creation flaw in better-auth's API keys plugin that enables attackers to mint privileged credentials for arbitrary users; this post details the bypass, exploitation path, and how we found it.

Etienne Lunetta, on zeropath.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The authorization check incorrectly treats a request as authenticated if it contains a userId in the body, skipping session validation and server-only field checks.

Impact

An unauthenticated attacker could mint API keys for any user, bypass MFA, and take over accounts; only deployments with the API keys plugin enabled are affected.

What the attacker needed

API keys plugin enabled; knowledge of victim's userId

The fix

Upgrade to better-auth version 1.3.26 or later, which fixes the authorization check.

How it was found

  1. Send an unauthenticated POST request to the API key creation endpoint with a JSON body containing the victim's userId.
  2. The server responds with a valid API key bound to the specified user.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

This is a flaw in an authentication library that lets anyone create API keys for other users without logging in. By simply providing a user ID in a request, an attacker can get a key that acts as that user, bypassing passwords and multi-factor authentication.

What is Account takeover?

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.