Auth
Your Better Auth app lets someone sign in as any user with just their email
Cataloged November 3, 2026 · Cursor · Bolt · v0 · Replit
Symptom
Nothing looks wrong. Sign-in works normally. This is for an app that uses Better Auth, the auth library many Next.js apps built with Cursor, Bolt, v0, or Replit use, with the Magic Link plugin plus Google, GitHub, or another social or Generic OAuth sign-in. On better-auth versions 1.4.0-beta.18 up to, but not including, 1.7.7, an attacker who only knows a user's email address can get a normal session as that user, without access to their mailbox and without signing in to the OAuth provider. If no account exists for that email and Magic Link sign-up is on, they can create one that is wrongly marked as email-verified.
Root cause
Better Auth accepted an OAuth sign-in state value as a Magic Link token. When OAuth state is stored in the database (account.storeStateStrategy set to database, the default when a database or secondary storage is configured) and Magic Link tokens are stored with the default storeToken plain, or with storeToken hashed together with global verification.storeIdentifier set to hashed, both flows write to the same verification storage and resolve to the same kind of identifier. An attacker starts an OAuth sign-in for any email, takes the returned state value, and finishes a Magic Link sign-in with it. The critical advisory is GHSA-965c-763c-88jm (CVE-2026-114607), published October 27, 2026. It is fixed in better-auth 1.7.7. The current latest is 1.7.15. A related high-severity advisory, GHSA-r4xp-prcw-77qf, affects the OAuth Proxy plugin from 1.5.0-beta.12 up to, but not including, 1.7.7, when the proxy has no dedicated secret or that secret equals the global Better Auth secret, state is stored in a cookie, and implicit account linking is on (the default). That one is also fixed in 1.7.7. Setting disableSignUp: true on the Magic Link plugin is not enough. It only stops new accounts that would be marked email-verified. It does not stop takeover of an account that already exists. Upgrade better-auth and all Better Auth adapters, plugins, and integrations released alongside it to the same version together. Upgrade every server that shares verification storage at the same time. After the upgrade, magic links and OAuth or SAML sign-ins that were pending before the upgrade cannot complete. Users request a new link or start sign-in again. No database migration is needed. If you have custom verification.storeIdentifier.overrides, update them to match the magic-link: and auth-state: prefixes. If you cannot upgrade right now, the advisory's workarounds are: set Magic Link storeToken to hashed and leave global verification.storeIdentifier unset or plain; or turn off Magic Link sign-in; or turn off social and Generic OAuth sign-in. Switching account.storeStateStrategy to cookie is also listed, but that exposes the OAuth Proxy path unless the proxy has its own distinct secret, so upgrade first.
Before and after
package.json. The before line is a better-auth version inside the affected range, which starts at 1.4.0-beta.18 and stops before 1.7.7. The after line is 1.7.15, the current latest. 1.7.7 is the first fixed release. Move every @better-auth/* package to the same version and commit the lockfile. No database migration.
Before
"better-auth": "1.4.0-beta.18"
After
"better-auth": "1.7.15"
Fix prompt
In this project only. Do not scan or test anyone else's app. 1. Check this project's better-auth version in package.json and the lockfile. Report the installed version. If this project does not use better-auth, say so and stop. 2. If it is below 1.7.7, upgrade better-auth and every @better-auth/* package to the same latest 1.7.x version together. Reinstall, and commit package.json and the lockfile. Do not add a database migration. 3. Then show me my Better Auth config. Say whether the magicLink plugin is enabled, which social or genericOAuth providers are enabled, what account.storeStateStrategy and magicLink storeToken are set to, whether verification.storeIdentifier is set, and whether the oAuthProxy plugin is used and has its own secret different from BETTER_AUTH_SECRET. Do not print the secret values. 4. If verification.storeIdentifier.overrides is set, update those overrides to match the magic-link: and auth-state: prefixes, and show me the diff. 5. Tell me that every server which shares this project's verification storage has to move to the same version at the same time. After the upgrade, magic links and OAuth or SAML sign-ins that were pending before the upgrade cannot complete. Users request a new link or start sign-in again. 6. Do not change any secrets, and do not turn off sign-in methods without asking me. If I say I cannot upgrade yet, the advisory's workarounds are: set Magic Link storeToken to hashed and leave global verification.storeIdentifier unset or plain; or turn off Magic Link sign-in; or turn off social and Generic OAuth sign-in. Do not switch account.storeStateStrategy to cookie unless I ask. That setting is listed in the advisory, but it exposes the OAuth Proxy path unless the proxy has its own secret, different from the global Better Auth secret. Do not print keys, tokens, passwords, or environment variable values. Do not edit unrelated files.
Paste this into the coding tool that has your own project open.
2-minute self-check
These steps are for an app you own. Do not run them against someone else's project.
- In your own project, run npm ls better-auth, or open the lockfile, and confirm the installed version is 1.7.7 or later. Anything from 1.4.0-beta.18 up to, but not including, 1.7.7 is in the range of GHSA-965c-763c-88jm.
- In the same list, check that every @better-auth/* package is on that same version. Adapters, plugins, and integrations released alongside better-auth move together.
- Confirm the version deployed in production matches the version you just checked. After you upgrade, redeploy. Upgrade every server that shares verification storage at the same time.
- In your own auth config, note whether the magicLink plugin and any social or genericOAuth provider are both enabled. If you are still below 1.7.7 with both on, apply a workaround today: set Magic Link storeToken to hashed and leave global verification.storeIdentifier unset or plain, or turn off Magic Link sign-in, or turn off social and Generic OAuth sign-in. Setting disableSignUp: true only stops new verified accounts. It does not stop takeover of an account that already exists.
- If your own config uses the oAuthProxy plugin, confirm it has its own secret, different from your main Better Auth secret. Do not print the secret. GHSA-r4xp-prcw-77qf covers the plugin from 1.5.0-beta.12 up to, but not including, 1.7.7 when that secret is missing or equal to the global secret, state is stored in a cookie, and implicit account linking is on (the default).
Common questions
I set disableSignUp: true on the Magic Link plugin. Does that close this?
No. It only stops new accounts that would be marked email-verified. It does not stop takeover of an account that already exists. The fix is to upgrade better-auth to 1.7.7 or later. The current latest is 1.7.15.
Do I need a database migration when I upgrade?
No. Upgrade better-auth and every Better Auth adapter, plugin, and integration released alongside it to the same version, and upgrade every server that shares verification storage at the same time. After the upgrade, magic links and OAuth or SAML sign-ins that were already pending cannot finish. Users request a new link or start sign-in again. If you set custom verification.storeIdentifier.overrides, update them to the magic-link: and auth-state: prefixes.
I cannot upgrade today. What does the advisory say I can change?
Set Magic Link storeToken to hashed and leave global verification.storeIdentifier unset or plain. Or turn off Magic Link sign-in, or turn off social and Generic OAuth sign-in. Switching account.storeStateStrategy to cookie is also listed, but that exposes the OAuth Proxy path unless the proxy has its own secret, different from the global Better Auth secret. Upgrade first when you can. The related advisory GHSA-r4xp-prcw-77qf is also fixed in 1.7.7.