GHSA-48C2-W96J-MV3M
@better-auth/kysely-adapter: MySQL serial IDs can return another request's record
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-48C2-W96J-MV3M divulgada · CVSS 6.8 (GitHub) | |
| Remediación | Parche 1.7.16 | @better-auth/kysely-adapter · 0 d desde divulgación | |
| Remediación | Parche 1.8.0-beta.5 | @better-auth/kysely-adapter · 0 d desde divulgación | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Am I affected?
You are affected if all of these are true:
- Your database is MySQL or MariaDB.
- You set `advanced.database.generateId: "serial"`.
- You use the default Kysely adapter or the Drizzle adapter with a connection pool.
You are not affected with other databases or other ID settings.
Summary
After inserting a row, the adapter read the new ID back with a separate query. On a connection pool, that query could run on a different connection and return the ID of a row inserted by another request.
Impact
Under ordinary concurrent load, a user who signs in can receive another user's session and act as that user. A sign-up can also return another user's record. Other requests fail with an error. The attacker cannot choose which account they receive.
Patches
Upgrade `better-auth` and your adapter package (`@better-auth/kysely-adapter` or `@better-auth/drizzle-adapter`) to 1.7.16, or to 1.8.0-beta.5 on the beta line.
Workarounds
If you cannot upgrade, stop using `generateId: "serial"` on MySQL. A single-connection pool does not prevent this.
Technical details
The MySQL branch ran the insert on the pool and then read `LAST_INSERT_ID()` in a separate transaction. `LAST_INSERT_ID()` is scoped to a connection, so the second query could see another request's insert. The adapters now use the ID reported by the insert itself, and fail instead of guessing when no ID is reported.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npm@better-auth/kysely-adapter |
Corregida | 1.7.16, 1.8.0-beta.5 | 0 d · 0 d | 1.7.25 no afectada |
npm@better-auth/drizzle-adapter |
Corregida | 1.7.16, 1.8.0-beta.5 | 0 d · 0 d | 1.7.25 no afectada |
npmbetter-auth |
Corregida | 1.7.16, 1.8.0-beta.5 | 0 d · 0 d | 1.7.25 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-48c2-w96j-mv3mLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
