Skip to content
NewCybercrime Report 2026 · Eight Chapters · A Post Is Not An Incident → Explore The ChaptersCybercrime Report 2026 → Explore

Better Auth Session Mix-Up via MySQL Serial IDs (CVE-2026-134313)

CVE-2026-134313 is a Better Auth race condition involving MySQL or MariaDB serial IDs.

Reviewed by
Brandefense Analyst Team
Published
Reading Time
3 min read
CVE ID
CVE-2026-134313
Vendor
Better Auth
Affected Product
better-auth; @better-auth/kysely-adapter; @better-auth/drizzle-adapter
Exploitation
Not confirmed
Published
2026-11-03

The adapter inserts a row, then reads its new ID in a separate query. A connection pool may send that second query to another connection, associating the first request with another request's row.Better Auth says an ordinary concurrent sign-in can give a user another user's session and let them act as that user. Sign-up can also return another user's record; some requests instead fail. The attacker cannot choose the account received.

What it allows

How Can CVE-2026-134313 Mix Up Sessions?

Better Auth says the MySQL branch inserted a row through a connection pool and fetched its serial ID separately. MySQL's inserted-ID value belongs to one connection. If the second query reaches another pooled connection, the adapter can associate the request with another request's inserted record.

The sign-in outcome can cross an account boundary without the attacker choosing a target account. Review unexpected account changes reported during sign-in and sign-up, and correlate them with application authentication logs. This is our investigation guidance based on the vendor's impact description, not a published detection signature.

Prioritize applications with concurrent authentication traffic and the required database setting. Use the Vulnerability Intelligence platform as product context for organizing the affected application inventory. The exposure depends on the configuration and adapter, not simply on a package name.

Who is affected

Which CVE-2026-134313 Versions and Configurations Are Affected?

Better Auth lists better-auth versions before 1.7.16 and beta versions 1.8.0-beta.0 through versions before 1.8.0-beta.5. For @better-auth/kysely-adapter and @better-auth/drizzle-adapter, the first affected range starts at 1.5.0-beta.9 and ends before 1.7.16. Both adapters also have the same 1.8.0 beta range.

All three conditions must hold: MySQL or MariaDB, advanced.database.generateId set to serial, and the default Kysely adapter or pooled Drizzle adapter. Better Auth says other databases and other ID settings are not affected. Inventory the installed core and adapter versions together, then check the application's database and ID configuration.

The vendor's better-auth stable range has no lower version boundary, so this page does not offer an automatic version comparison. Assess that package against the documented range manually. Record installed and running versions in your patch management process; the vulnerability intelligence glossary explains how to place this finding in broader triage.

Timeline

  1. 2026-11-03

    Better Auth published GHSA-48c2-w96j-mv3m with affected packages, conditions, fixes, and a workaround.

  2. 2026-11-21

    NVD published the CVE-2026-134313 record.

What to do

  1. Identify exposed applications

    Record the installed better-auth and adapter versions, MySQL or MariaDB use, serial ID setting, and connection pool configuration. Confirm each condition before labeling an application affected.

  2. Upgrade the core and adapter

    Update better-auth and the installed Kysely or Drizzle adapter to 1.7.16 on the stable line, or 1.8.0-beta.5 on the beta line. Follow the vendor's advisory for package scope.

  3. Verify the running versions

    After deployment, confirm the application actually runs the fixed better-auth and adapter package versions. Check the dependency lockfile and deployed runtime rather than assuming an install command changed production.

  4. Apply the vendor workaround if an upgrade must wait

    Stop using generateId: serial on MySQL until the upgrade is complete. Better Auth says a single-connection pool does not prevent the issue; validate any configuration change in the application before rollout.

What Brandefense can do

Frequently Asked Questions

Does CVE-2026-134313 affect every Better Auth deployment?

No. Better Auth requires MySQL or MariaDB, serial ID generation, and the specified Kysely or pooled Drizzle adapter configuration. Check all three conditions and the installed versions.

Can an attacker choose whose session they receive?

Better Auth says they cannot choose the account. Under concurrent load, a sign-in may receive another user's session, while other requests may fail.

Does a single database connection remove the risk?

No. Better Auth explicitly says a single-connection pool does not prevent this issue. Upgrade both the core and adapter packages, or stop using serial ID generation on MySQL temporarily.

Which releases contain the fix?

Better Auth names 1.7.16 for the stable line and 1.8.0-beta.5 for the beta line. Apply the matching core and adapter package updates, then verify their running versions.

Sources

  1. MySQL Serial IDs Can Return Another Request's RecordBetter Auth
  2. CVE-2026-134313 DetailNIST NVD
ShareLinkedInX
Brandefense logo

Stay Ahead of Digital Threats.

Take control of your digital security with an exclusive demo of our AI-driven threat intelligence platform.

Open The Full Demo Form →