GHSA-QQ9H-G4JM-XGF3

GHSA-QQ9H-G4JM-XGF3 is a high-severity improper authentication vulnerability in better-auth (npm), affecting versions >= 1.1.3, < 1.6.22. It is fixed in 1.6.22, 1.7.0-beta.10.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

Better Auth: Account takeover via pre-account hijacking on magic-link and email-OTP sign-in

Am I affected

You are affected if all of the following hold:

  • You run a better-auth version below 1.6.22, or a 1.7.0-beta below 1.7.0-beta.10.
  • You enable the magic-link plugin or the email-OTP plugin.
  • You also enable email and password sign-up with open registration.
  • An account can exist at an address before its owner first signs in with the passwordless flow.

An attacker can keep password access to a victim's account after the victim starts using it. The attack runs in three steps. First, with open registration, the attacker signs up using the victim's email and a password the attacker picks. The account stays unverified, so the attacker cannot use it yet. Later the real owner signs in with a magic link or an email OTP. That step marks the account verified, and the attacker's password now works on it.

Details

When an account already exists for an address, magic-link verification and email-OTP sign-in both sign in to that account. They mark it verified and issue a session. Before the fix, neither one removed a password set while the account was still unverified. Neither one revoked existing sessions. So a password set before anyone proved control of the mailbox kept working after the owner proved control.

This is a pre-account-hijacking weakness. It is the same class as the OAuth advisory GHSA-g38m-r43w-p2q7, applied to the passwordless email flows. Requiring email verification does not stop it. The verification step is the exact moment that turns the planted account into a usable one.

The fix treats current proof of control over the address as authoritative. When either flow finds an account whose email was never confirmed, it now removes the password and revokes existing sessions first. Only then does it mark the account verified and issue the new session. The owner signs in as before. Only access created before the proof is removed.

Workarounds

If you cannot upgrade right away, you can lower the risk in two ways. Require email verification before you accept any password on an account. Remove unverified accounts quickly, so an address cannot sit reserved for long. Both steps shrink the opening, but they do not close it. Upgrading is the real fix.

Credit

Reported by the Vercel security team.

Impact

The attacker gains lasting password access to an account the victim depends on, alongside the victim. From there the attacker can read and change the victim's data. The attacker can also reset the credentials and lock the victim out. The takeover only completes when the victim signs in through the passwordless flow. It also needs a setup that pairs that flow with open email and password sign-up.

The application does not adequately verify the identity of a user, device, or process before granting access. Typical impact: unauthorized access to functions or data reserved for authenticated parties.

GHSA-QQ9H-G4JM-XGF3 has a CVSS score of 8.3 (High). The vector is network-reachable, no privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.6.22, 1.7.0-beta.10); upgrading removes the vulnerable code path.

Affected versions

better-auth (>= 1.1.3, < 1.6.22) better-auth (>= 1.7.0-beta.0, < 1.7.0-beta.10)

Security releases

better-auth → 1.6.22 (npm) better-auth → 1.7.0-beta.10 (npm)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Upgrade to better-auth 1.6.22 or later on the stable line. On the 1.7 pre-release line, upgrade to 1.7.0-beta.10 or later. Earlier 1.7 betas, up to and including 1.7.0-beta.9, still contain the bug.

Frequently Asked Questions

  1. What is GHSA-QQ9H-G4JM-XGF3? GHSA-QQ9H-G4JM-XGF3 is a high-severity improper authentication vulnerability in better-auth (npm), affecting versions >= 1.1.3, < 1.6.22. It is fixed in 1.6.22, 1.7.0-beta.10. The application does not adequately verify the identity of a user, device, or process before granting access.
  2. How severe is GHSA-QQ9H-G4JM-XGF3? GHSA-QQ9H-G4JM-XGF3 has a CVSS score of 8.3 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of better-auth are affected by GHSA-QQ9H-G4JM-XGF3? better-auth (npm) versions >= 1.1.3, < 1.6.22 is affected.
  4. Is there a fix for GHSA-QQ9H-G4JM-XGF3? Yes. GHSA-QQ9H-G4JM-XGF3 is fixed in 1.6.22, 1.7.0-beta.10. Upgrade to this version or later.
  5. Is GHSA-QQ9H-G4JM-XGF3 exploitable, and should I be worried? Whether GHSA-QQ9H-G4JM-XGF3 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether GHSA-QQ9H-G4JM-XGF3 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix GHSA-QQ9H-G4JM-XGF3?
    • Upgrade better-auth to 1.6.22 or later
    • Upgrade better-auth to 1.7.0-beta.10 or later

Other vulnerabilities in better-auth

Stop the waste.
Protect your environment with Kodem.