NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · npm

GHSA-r4xp-prcw-77qf: better-auth: OAuth Proxy lets an attacker sign in as another user

highCVSS 3.1 7.4

In better-auth 1.5.0-beta.12 up to 1.7.7 (exclusive), the OAuth Proxy plugin accepts sign-in state as if it were a provider profile. An unauthenticated attacker who knows a user's verified email can sign in as that user. Only setups with cookie-stored state, a proxy secret missing or equal to the global secret, and implicit account linking are exposed. Upgrade to 1.7.7.

Published Oct 27, 2026 · Analysis Nov 1, 2026

What an attacker can do

The OAuth Proxy plugin trusts any user profile it can decrypt. In the affected setup, Better Auth encrypts sign-in state with the same secret as the proxy payload, including data the caller chose, and returns it to anyone who starts a social sign-in. The attacker takes that machinery and builds a fake profile carrying a victim's email address. The proxy callback accepts it as a real provider identity (CWE-345, CWE-287).

Because implicit account linking is on by default, the fake identity links to the existing account. The attacker then holds a session with the victim's permissions. They can read private data, change the account and link a provider account of their choice. They need no provider sign-in and no action from the victim.

The attacker must know the victim's verified email address. The advisory sets attack complexity high for that reason, and for the specific configuration needed. It reports no availability impact and says a reported open redirect was not confirmed. Multi-environment setups that share the proxy, such as production plus preview deployments, are the typical users of this plugin.

Who is affected

Affected: better-auth from 1.5.0-beta.12 up to but not including 1.7.7, with the OAuth Proxy plugin. All of these must also hold on a participating environment:

  • The proxy has no dedicated secret, or it equals the global Better Auth secret.
  • Sign-in state is cookie-stored (account.storeStateStrategy: "cookie"). With a database or secondary storage this applies only if you chose it.
  • Implicit account linking is on (the default).

Versions before 1.5.0-beta.12 are not affected by this path.

npm ls better-auth

better-auth

Ecosystem
npm
Affected
>= 1.5.0-beta.12, < 1.7.7
Fixed in
1.7.7
Check
npm ls better-auth

How to fix it

Upgrade to better-auth 1.7.7:

npm install [email protected]

Upgrade every OAuth Proxy participant together, including the production coordinator and preview or development deployments. Keep other Better Auth packages on the same release version. Pending sign-in and account-linking flows must be restarted, because pre-upgrade state cookies and proxy payloads are rejected. Public options and API signatures are unchanged.

Workarounds from the advisory:

  • Set one strong OAuth Proxy secret on every participating environment, different from each global Better Auth secret.
  • Set account.storeStateStrategy: "database". If Magic Link is also enabled, check the advisory first: switching can expose a separate verification-record path in affected releases.
  • Remove the OAuth Proxy plugin if you do not need it.

Setting account.accountLinking.disableImplicitLinking: true blocks account takeover on this path, but does not fix the flaw. Combine it with a step above.

How to tell if you were hit

Look for sign-ins through the OAuth Proxy callback where the account's provider identity is new but the email matches an existing user. Look for new provider accounts linked to existing users that the user did not initiate. Check for sessions created from unfamiliar IPs just after such a callback.

Review your configuration for the three preconditions: proxy secret unset or equal to the global secret, storeStateStrategy set to cookie, and implicit linking left on. If any account shows an unexpected linked provider, unlink it and revoke the user's sessions.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

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.

Credited to iabdullah215, martinfrancois.

Questions

Which better-auth version fixes this?

Version 1.7.7. The advisory text calls it planned, but the v1.7.7 release page lists the fix as pull request 11494 and says to upgrade all OAuth Proxy participants together.

Am I affected if I do not use the OAuth Proxy plugin?

Not by this flaw. It sits in the OAuth Proxy callback. Without the plugin there is no proxy path to feed a forged profile into.

Does the attacker need a victim to click anything?

No. The vector shows no user interaction and no privileges. The attacker only needs to know the victim's verified email address.

Does disabling implicit account linking fix it?

Only partly. It stops takeover of an existing account on this path, but the callback can still accept attacker-made data as a provider identity. Also set a distinct proxy secret or database state storage.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More npm vulnerabilities

All npm entries