Intel

AIKIDO-2026-745285

@better-auth/kysely-adapter is vulnerable to Race Condition

GHSA-48c2-w96j-mv3mPublished Nov 4, 2026
November 4, 2026

68

CVE Score

Medium

Race Condition

Are you affected? Scan for Free

TL;DR

When MySQL or MariaDB is used with advanced.database.generateId: "serial", the Kysely and Drizzle adapters inserted a row on the connection pool and then read the new ID back with a separate LAST_INSERT_ID() query. Because LAST_INSERT_ID() is scoped to a connection, that second query could run on a different pooled connection and return the ID of a row inserted by another concurrent request. Under ordinary load, a user signing in could receive another user's session and act as that user, and a sign-up could return another user's record. The attacker cannot choose which account they receive. The fix uses the ID reported by the insert itself and fails instead of guessing when no ID is reported.

How do I fix this?

Upgrade both @better-auth/kysely-adapter and better-auth to the patch version. Until you upgrade, stop using generateId: "serial" on MySQL or MariaDB. A single-connection pool does not prevent this issue.

Who does this affect?

You are affected if you use @better-auth/kysely-adapter within the vulnerable range with MySQL or MariaDB, a connection pool, and advanced.database.generateId: "serial". Other databases and ID settings are not affected.

Versions

1.5.0 - 1.7.15

Fixed in 1.7.16

Background info

@better-auth/kysely-adapter is vulnerable to Race Condition in versions 1.5.0 - 1.7.15.

Get secure today,
quickly and for free.

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.

Trusted by 150k+ orgs
  • Revolut
  • n8n
  • Lovable
  • Deel
  • Prove
  • Omnea