better-auth is vulnerable to Authentication Bypass
48
CVE Score
Medium
Authentication Bypass
The emailOTP() plugin in better-auth has three weaknesses. First, the OTP attempt counter was read and written in separate steps, so concurrent guesses could be counted as a single attempt and an attacker could exceed allowedAttempts to brute-force an active OTP and sign in or reset a password. Second, email change codes were stored under a key built from both addresses, so different address pairs could collide and a code requested from one account could be used from another, letting a signed-in user mark an address they do not own as verified. Third, on databases with accent-insensitive collation (common on MySQL), a lookup by email could return an account whose stored address differs only by accents, and password reset sent the code to the requested address instead of the account's own, allowing password reset for the victim account. The fix counts every guess against the limit, binds email change codes to the requesting account and new address, and only returns users whose stored address matches the requested one (case-insensitive).
Upgrade the better-auth library to the patch version. Email change codes sent before the upgrade must be requested again. As a workaround, disable email change in the email OTP plugin (the default) and use the core email change flow instead; lowering allowedAttempts and the OTP lifetime reduces, but does not fix, the attempt limit issue.
You are affected if you are using a version that falls within the vulnerable range and use the emailOTP() plugin. The attempt limit issue affects any email OTP flow. The email change code issue additionally requires changeEmail.enabled: true in the plugin (version 1.5.0 or later). The accented address issue additionally requires a database collation that ignores accents, which is common on MySQL.
1.3.7 - 1.7.15
Fixed in 1.7.16better-auth is vulnerable to Authentication Bypass in versions 1.3.7 - 1.7.15.
Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.
No credit card required | Scan results in 32 seconds.
I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant
ISO 42001Compliant© All Intel data is openly available and commercially licensed.