GHSA-Q747-MQGR-4GH7
better-auth: Phone numbers can be claimed before they are verified
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-Q747-MQGR-4GH7 divulgada · CVSS 8.1 (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 phone number plugin from `better-auth` 0.4.12-beta.7 or later.
The shared code problem below affects 1.2.6-beta.8 and later, when you have not set a custom `verifyOTP` function.
Summary
Unverified numbers. Sign-up and other flows could save a phone number on an account before anyone proved they own it. Phone sign-in then picked whichever account held the number. A one-time code (OTP) proves who controls the phone, not who owns that account.
Shared codes. Phone verification codes were stored next to codes from other flows without a separate namespace. Wrong phone attempts could delete a pending code that another flow issued to a different user.
Impact
An attacker can save a victim's phone number on an account the attacker controls. When the victim later signs in with a valid OTP sent to their own phone, the victim gets a session for the attacker's account. Data the victim then enters may become available to the attacker. The attacker does not intercept or bypass the OTP, and does not get into the victim's own account.
With the shared code problem, anyone who can predict a pending code's record identifier can cancel it repeatedly. This blocks that user's sign-in or recovery attempt. It does not give access to the account.
Patches
Upgrade `better-auth` to 1.7.16, or to 1.8.0-beta.5 on the beta line.
1.7.16 stops new unverified numbers. Sign-up and sign-in requests that send a `phoneNumber` are rejected, and a number from a social profile is not stored, including on account linking. 1.8.0-beta.5 also requires proof of account ownership before a pending number is verified, which covers numbers saved before the upgrade.
On 1.7.16, clear numbers saved before the upgrade as shown in Workarounds.
Workarounds
Clear phone numbers that were never verified. For example, on PostgreSQL with the default schema names:
UPDATE "user" SET "phoneNumber" = NULL
WHERE "phoneNumber" IS NOT NULL AND "phoneNumberVerified" IS NOT TRUE;Users who had not finished verification need to add their number again.
Until you upgrade, stop public flows from saving `phoneNumber` before verification, for example by removing it from sign-up request bodies. A strict `phoneNumberValidator` reduces the shared code problem but does not fix it.
Technical details
Phone OTP sign-in and verification looked up the account by `phoneNumber` without requiring `phoneNumberVerified`. 1.7.16 rejects a `phoneNumber` in sign-up and sign-in request bodies, drops an unverified number from `createUser` data and social profiles, and drops an unverified number written during a request outside the plugin's verification path and the admin update route. Verification codes now use a phone-specific identifier. With `requireVerification`, phone password reset now also needs a verified number.
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-q747-mqgr-4gh7Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
