GHSA-2F9C-7XJ7-GH55
better-auth: Email OTP attempt limit can be raced and codes are loosely bound to addresses
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-2F9C-7XJ7-GH55 divulgada · CVSS 4.8 (GitHub) | |
| Remediación | Parche 1.7.16 | better-auth · 0 d desde divulgación | |
| Remediación | Parche 1.8.0-beta.5 | better-auth · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Am I affected?
You are affected if you use the `emailOTP()` plugin from `better-auth` 1.3.7 or later. Each problem below adds its own condition:
- Attempt limit: any email OTP flow.
- Email change codes: `changeEmail.enabled: true` in the plugin, from 1.5.0.
- Accented addresses: a database collation that ignores accents, common on MySQL.
Summary
Attempt limit. Guesses that arrive at the same time could be counted as one attempt, so an attacker could make more guesses than `allowedAttempts` allows.
Email change codes. Codes for changing an email address were stored under a key built from both addresses. Two different address pairs could produce the same key, so a code requested from one account could be used from another.
Accented addresses. On databases that ignore accents, a lookup for an address could return an account with a different stored address. Password reset then sent the code to the requested address, not the account's own.
Impact
With the attempt limit problem, an unauthenticated attacker can make extra guesses against an active OTP and, if a guess hits, sign in or reset the password.
With the email change problem, a signed-in user can mark an unused address on their own account as verified. The real owner of that address may later be signed in to the attacker's account.
With the accented address problem, an attacker who receives mail at an address that differs from the victim's only by accents can reset the victim's password, with no action from the victim.
Patches
Upgrade `better-auth` to 1.7.16, or to 1.8.0-beta.5 on the beta line. Email change codes sent before the upgrade must be requested again.
Workarounds
Turn off email change in the email OTP plugin, which is the default, and use the core email change flow instead. Lowering `allowedAttempts` and the OTP lifetime reduces the attempt limit problem but does not fix it.
Technical details
The attempt counter was read and written in separate steps, so concurrent checks could each see the same count. Every guess now counts against the limit, and a correct check still leaves the OTP usable for the follow-up call. Email change codes are now bound to the requesting account and the new address. Looking up a user by email now returns an account only when its stored address matches the requested one, ignoring case, and the reset routes send the code to the address on the account.
Credit
The accented address problem was discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-Y7X5RTID.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npmbetter-auth |
Corregida | 1.7.16, 1.8.0-beta.5 | 0 d · 0 d | 1.7.26 no afectada |
1.7.161.8.0-beta.5Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/better-auth/better-auth/security/advisories/GHSA-2f9c-7xj7-gh55Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
