CVE-2025-61928 PoC and fix: Better Auth API keys created without logging in

CVE-2025-61928 is a critical flaw in Better Auth before 1.3.26. With the API key plugin enabled, a request with no session could create or change an API key for any user, by putting that user's id in the request body, then act as that user. The researcher's write-up includes a proof of concept. Upgrade to 1.3.26 or later, then review and replace the API keys created before the patch.

The team behind Keybrum's attacksUpdated 8 min read
CVE-2025-61928critical · CVSS 9.3
Component
Better Auth API key plugin (create and update routes) (better-auth)
Affected
better-auth before 1.3.26, only with the API key plugin enabled, on any host
Fixed in
1.3.26. Latest release on 15 November 2026: 1.7.25
Published
October 9, 2025
Does it reach a version you install? Drop your lockfile in the dependency checker: it reads every package, this one included.

In short

  • On Better Auth before 1.3.26 with the API key plugin, anyone could create an API key for any user whose id they knew, with no login, and use it as that user. The same flaw let them change existing keys.
  • Only apps that enable the API key plugin are affected. An app that uses Better Auth for sign-in alone is outside this CVE.
  • Fixed in 1.3.26, published on 3 October 2025, the day after the report. On 15 November 2026 the latest release is 1.7.25, and the most recent critical advisories need at least 1.7.16.
  • Upgrading does not delete a key an attacker already created. Review the apikey table and replace the keys you cannot account for.
  • The CVE record scores it 9.3, critical, in CVSS 4.0. GitHub's advisory database lists it as high, 8.6, in CVSS 3.1. Both describe the same thing: no login needed, full access as the victim.
On this page

What CVE-2025-61928 is, in plain words

Better Auth is an authentication library for TypeScript apps. Its API key plugin lets your users create keys to call your app from scripts and other servers, the way they would with a Stripe or OpenAI key. The plugin adds two routes that matter here: one creates a key, one updates it. Both sit under your auth path, /api/auth/api-key/create and /api/auth/api-key/update with the default settings.

The same code serves two callers. Your own server may call it directly and name the user the key is for, with a userId field. A browser may call it over HTTP, and then the user must come from the session cookie. Before 1.3.26, the route told the two apart the wrong way: when a request had no session but carried a userId in its body, the code treated it as the trusted server-side call. The advisory sums it up: the endpoints could treat attacker-controlled input as an authenticated user object.

The checks that stop a browser from setting server-only fields, such as permissions and rate limits, only ran on the authenticated path. So the forged request skipped them too.

What a stranger can do with it

Your appWhat a request with no login can do
Better Auth before 1.3.26, API key plugin enabledCreate an API key for any user whose id is known, then call your app as that user wherever it accepts API keys
The same app, a user who already has keysChange an existing key's settings through the update route, according to the advisory
Better Auth before 1.3.26, no API key pluginNothing through this CVE: the routes do not exist
Better Auth 1.3.26 or laterThe request is refused: a call that arrives over HTTP needs a session, and a signed-in user cannot name another user
From GitHub advisory GHSA-99h5-pjcv-gr6v and the fix commit.

Two details make it worse than a stolen password. An API key skips the sign-in screen, so two-factor authentication does not stand in the way: ZeroPath, which found the flaw, describes the result as minting keys for target users and bypassing MFA. And API keys tend to live long. A session expires; a key created quietly in October can still work a year later.

Severity, proof of concept and exploitation status

Two scores circulate. The CVE record, written by GitHub as numbering authority for the maintainers, gives 9.3, critical, in CVSS 4.0 (AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N). GitHub's advisory database lists it as high, 8.6, in CVSS 3.1 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:L). The scales differ; the reading does not. No account, no click from a victim, and the attacker ends up signed in as someone else.

Who is affected

Two conditions together: better-auth before 1.3.26, and the API key plugin in your auth config. ZeroPath states that every release containing the plugin was susceptible up to the fix.

ConditionExposedNot exposed
Better Auth versionAny version before 1.3.261.3.26 and later
API key pluginapiKey() listed in the plugins of your betterAuth() configNo API key plugin
HostingAny host. The flaw is in the library, so Vercel, a VPS or a container all run the same codeThe advisory excludes no host

In the affected versions the plugin shipped inside the better-auth package itself. Today the docs install it from a separate package, @better-auth/api-key, which is why the check below searches for the call, not for one import path.

Apps built with AI tools

If a coding agent such as Cursor or Claude Code set up Better Auth for you, it may also have added the API key plugin the day you asked for an API for customers, a CLI or an integration. The version it installed is the one that was current that day, pinned in the lockfile since. If the project dates from before October 2025 and was never updated, check it.

How to check your own app

bash
# Installed version: use the line for your package manager
npm ls better-auth
pnpm why better-auth
yarn why better-auth

# Is the API key plugin enabled?
grep -rn "apiKey(" --include=*.ts --include=*.tsx --include=*.js --exclude-dir=node_modules .
A version before 1.3.26 together with an apiKey() call in your auth config means the app was exposed.

Check the installed version, not the range in package.json: "better-auth": "^1.3.0" can still be locked to 1.3.10. Then check what production runs. A patched repository does not help if the last deploy predates the upgrade.

Keybrum has no attack for CVE-2025-61928. Proving it would mean creating a working credential for one of your users, and the version check answers the question without that. Keybrum does test a newer Better Auth flaw on live apps whose owner proved ownership: web.better-auth-expo-proxy sends one request to the Expo plugin's authorization proxy and proves its open redirect (GHSA-4wq4-2ppv-q3hg, fixed in 1.7.16).

How to fix CVE-2025-61928

Upgrade. The fix is in 1.3.26, published on 3 October 2025. The fix commit changes the create route in two ways: any call that arrives over HTTP now needs a session, whatever its body says, and a signed-in user who names a different userId is refused.

1.3.26 is a floor, not a target. Better Auth has published more advisories since, several of them critical. The two most recent critical ones are a Magic Link flaw fixed in 1.7.7 and the Expo plugin flaw fixed in 1.7.16. On 15 November 2026 the latest release on npm is 1.7.25.

bash
npm install better-auth@latest
# if you use the separate plugin packages, keep them on the same version
npm ls better-auth @better-auth/api-key @better-auth/expo
A jump from 1.3.x to 1.7.x crosses several minor versions. Read the Better Auth changelog, run your sign-in tests, commit the lockfile, then redeploy.

If you cannot upgrade today

The advisory lists no workaround. Two stopgaps follow from how the flaw works. Remove apiKey() from the plugins if nobody uses API keys yet: the routes disappear with it. Or refuse the two routes at your reverse proxy, which also stops your real users from creating keys in the browser until you patch.

nginx
# In the server block that proxies to your app. Adjust the path if you changed basePath.
location ~ ^/api/auth/api-key/(create|update)$ {
    return 403;
}
A stopgap, not a fix: keys your own server creates through auth.api.createApiKey keep working, keys created from the browser do not.

What to do after upgrading

The patch closes the door. It does not tell you who came in while it was open, and it does not remove the keys they made.

  1. 1

    List the keys that exist

    The plugin stores keys in a table named apikey. List them with their owner and creation date, and compare with what you and your users created on purpose. A key for an admin account that no admin remembers is the one to worry about.

  2. 2

    Replace what you cannot account for

    ZeroPath's advice is to rotate any API key created through the plugin during the exposure window and to invalidate unused credentials. Delete the doubtful keys and let their owners create new ones. Keys are stored hashed by default, so you cannot tell them apart by value: go by owner, name and date.

  3. 3

    Read the logs

    Look in your application and proxy logs for POST requests to /api/auth/api-key/create or /api/auth/api-key/update that carried no session cookie. ZeroPath also flags bodies that set userId, rateLimitMax or permissions.

  4. 4

    Check what a key is allowed to do

    A key acts as its user. If one user's key can read another user's records, that is a separate bug, the IDOR vulnerability, and no library upgrade fixes it.

sql
-- Newest keys first. The table name comes from the Better Auth docs.
-- Column names follow your adapter: "createdAt" by default,
-- created_at if you mapped fields to snake case.
select *
from apikey
order by "createdAt" desc
limit 100;
Run it in your own database. Pay attention to keys created before you deployed 1.3.26 or later.

Then read the rest of the Better Auth security guide: the secret, the trusted origins, the cookie settings and the later advisories. If you are still choosing an auth provider, Clerk and Supabase Auth compared covers two alternatives.

Timeline

DateEvent
1 October 2025ZeroPath scans better-auth 1.3.25 and finds the flaw
2 October 2025Reported to the maintainers
3 October 2025Better Auth 1.3.26 published with the fix
8 October 2025Advisory GHSA-99h5-pjcv-gr6v published
9 October 2025CVE-2025-61928 published on cve.org and NVD
10 October 2025CISA's assessment: proof of concept available, automatable, total technical impact
19 October 2025ZeroPath publishes its write-up
13 November 2026Still absent from CISA's Known Exploited Vulnerabilities catalog

Questions

Is there a public PoC for CVE-2025-61928?

Yes. ZeroPath, which found the flaw, published a write-up on 19 October 2025 that shows the request, and CISA rated a proof of concept as available on 10 October 2025. The CVE is not in CISA's Known Exploited Vulnerabilities catalog. This page does not reproduce the request: the version check answers the question for your own app.

Am I affected if I do not use the API key plugin?

No. The flaw is in the create and update routes of the API key plugin, and those routes only exist when apiKey() is listed in your Better Auth plugins. Upgrade anyway: later Better Auth advisories affect other plugins and the core.

Which Better Auth version fixes CVE-2025-61928?

1.3.26, published on 3 October 2025. Every earlier version that contains the API key plugin is affected. In November 2026 the latest release is 1.7.25, and the most recent critical advisories need at least 1.7.16.

Does two-factor authentication protect against it?

No. The forged request never signs in: it creates an API key directly, and an API key does not go through the sign-in screen. ZeroPath describes the impact as bypassing MFA.

Do I need to rotate API keys after upgrading?

Review them at least. The upgrade stops new forged keys, but a key created through the flaw stays valid until it expires or you delete it. List the apikey table, and replace every key created before the patch that you or your users cannot account for.

Is CVE-2025-61928 critical or high?

Both labels are in use. The CVE record carries a CVSS 4.0 score of 9.3, critical. GitHub's advisory database shows a CVSS 3.1 score of 8.6, high. They rate the same flaw on two different scales.

Sources

  1. 1.GHSA-99h5-pjcv-gr6v: Unauthenticated API key creation through api-key plugin, Better Auth on GitHub
  2. 2.CVE-2025-61928, NIST National Vulnerability Database
  3. 3.CVE-2025-61928, CVE Program
  4. 4.GitHub advisory database: GHSA-99h5-pjcv-gr6v, GitHub
  5. 5.Breaking authentication: unauthenticated API key creation in better-auth (CVE-2025-61928), ZeroPath
  6. 6.fix: [security] api keys should properly check if a request is from client or server (fix commit), Better Auth on GitHub
  7. 7.API Key plugin, Better Auth Docs
  8. 8.API Key plugin reference: schema and options, Better Auth Docs
  9. 9.better-auth versions, npm
  10. 10.Known Exploited Vulnerabilities Catalog, CISA
  11. 11.EPSS score for CVE-2025-61928, FIRST

Your app is public. So are its mistakes.

Check what any attacker can already see in it, free, in ten seconds. The full attack, with proof and fixes: €49 once, or €29 a month on a plan.

or continue with Google or GitHub