GHSA-r4xp-prcw-77qf: High severity npm/better-auth vulnerability

Published Oct 27, 2026
·
Updated

Am I affected?

You may be affected if you use better-auth from 1.5.0-beta.12 through versions before 1.7.7 with the OAuth Proxy plugin. You are affected only if all of these are also true:

- On a participating environment, the OAuth Proxy plugin has no dedicated secret, or its secret equals that environment's global Better Auth secret. - Sign-in state is stored in a cookie (account.storeStateStrategy: "cookie"). With a database or secondary storage, this is only the case if you chose it explicitly. - Implicit account linking is on (the default).

You are not affected by this path if every participating environment uses a proxy secret distinct from its global Better Auth secret, if sign-in state is stored in the database, or if you use a version before 1.5.0-beta.12.

Summary

The OAuth Proxy plugin trusts any user profile it can decrypt. In the affected setup, Better Auth encrypts sign-in state, including data the caller chose, with the same secret and hands it to anyone who starts a social sign-in. An attacker can use this to get a fake profile for another user's email address that the proxy accepts as real.

Impact

An attacker without an account who knows a user's verified email address can sign in as that user, with that user's permissions. They can read private data, change the account, and link a provider account of their choice to it. They need no provider sign-in and no action from the victim. No availability impact is established, and a reported open redirect was not confirmed.

Patches

The fix is merged for the planned better-auth 1.7.7 release. That package is not available yet.

Upgrade all nodes handling the same cookie-backed OAuth or SAML state flow and all OAuth Proxy participants together, including the production coordinator and preview or development deployments. Keep installed Better Auth packages released alongside better-auth on the same release version. Restart pending sign-in and account-linking flows; pre-upgrade state cookies and proxy payloads are rejected. Public options and API signatures are unchanged.

Workarounds

Until you upgrade to the fixed release, apply one of these:

- Set one strong OAuth Proxy secret across every environment that takes part in the proxy flow, and keep it different from each environment's global Better Auth secret. - Set account.storeStateStrategy: "database". This is already the default when a database or secondary storage is configured. If Magic Link is also enabled, switching can expose a separate cross-purpose verification-record path in affected releases. Ensure the two flows resolve to distinct stored identifiers; with built-in options, use Magic Link storeToken: "hashed" with global verification.storeIdentifier unset or "plain", or disable Magic Link or both built-in social and Generic OAuth sign-in. - Remove the OAuth Proxy plugin if you do not need it.

Setting account.accountLinking.disableImplicitLinking: true stops this path from taking over an existing account. It does not fix the underlying flaw: the callback can still accept attacker-made data as a provider identity. Apply one of the steps above as well.

Affected Software

1 affected componentFixes available
npm/better-auth>=1.5.0-beta.12<1.7.7
1.7.7

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/better-auth to a version that resolves this vulnerability.

    Fixed in 1.7.7
  2. Upgrade

    Upgrade better-auth to a version that resolves this vulnerability.

    Fixed in 1.7.7
  3. Remove

    Remove OAuth Proxy plugin from your environment.

    Remove the OAuth Proxy plugin if it is not needed.

  4. Configuration

    Store sign-in state in the database by setting account.storeStateStrategy to "database".

    OAuth Proxy account.storeStateStrategy = database
  5. Configuration

    Set one strong OAuth Proxy secret across every participating environment and keep it different from each environment's global Better Auth secret.

    OAuth Proxy secret = one strong shared secret distinct from each environment's global Better Auth secret
  6. Configuration

    Disable implicit account linking by setting account.accountLinking.disableImplicitLinking to true.

    Better Auth account linking account.accountLinking.disableImplicitLinking = true
  7. Configuration

    If Magic Link is enabled, use Magic Link storeToken: "hashed" with global verification.storeIdentifier unset or set to "plain" so the two flows resolve to distinct stored identifiers; alternatively disable Magic Link or both built-in social and Generic OAuth sign-in.

    Magic Link and verification storeToken / verification.storeIdentifier = storeToken: "hashed"; verification.storeIdentifier unset or "plain"
  8. Operational

    Restart pending sign-in and account-linking flows; pre-upgrade state cookies and proxy payloads are rejected.

Event History

Oct 27, 2026
Advisory Published
via GitHub·03:32 PM
Data Sourced
via GitHub·03:32 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which deployments are exposed to this issue?

Exposure requires the OAuth Proxy plugin, a version from 1.5.0-beta.12 up to but not including 1.7.7, cookie-based sign-in state, and implicit account linking. The proxy must also lack a dedicated secret or use the same secret as that environment's global Better Auth secret.

2

Is implicit account linking alone enough to make an installation vulnerable?

No. Although implicit account linking is enabled by default, the vulnerable path also requires cookie-based sign-in state and an OAuth Proxy secret that is missing or matches the global Better Auth secret for a participating environment.

3

Does an attacker need an existing account to exploit this?

No. The issue can be exploited by an attacker without an account because the proxy may accept an attacker-crafted, decryptable profile as legitimate, including for another user's email address.

4

What can be changed if upgrading cannot happen immediately?

Configure a dedicated OAuth Proxy secret that differs from the global Better Auth secret in every participating environment. Moving sign-in state storage to the database also avoids this path.

5

How can I determine whether my deployment is affected?

Review the Better Auth version, confirm whether the OAuth Proxy plugin is enabled, check account.storeStateStrategy for "cookie", and compare each participating environment's proxy secret with its global Better Auth secret. Also verify whether implicit account linking remains enabled.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203