CVE-2026-134313
Received Received - Intake

Race Condition in Better Auth with MySQL/MariaDB Session Hijacking

Vulnerability report for CVE-2026-134313, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-11-21

Last updated on: 2026-11-21

Assigner: VulnCheck

Description

Better Auth (better-auth, @better-auth/kysely-adapter, and @better-auth/drizzle-adapter) before 1.7.16 and 1.8.0-beta.0 before 1.8.0-beta.5 contains a race condition with MySQL or MariaDB serial IDs because the inserted row's ID is read via a separate LAST_INSERT_ID() query that may run on a different pooled connection. Under concurrent load, a user signing in can receive another user's session and act as that user.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-11-21
Last Modified
2026-11-21
Generated
2026-11-21
AI Q&A
2026-11-21
EPSS Evaluated
N/A
NVD
EUVD

Affected Vendors & Products

Showing 2 associated CPEs
Vendor Product Version / Range
better_auth better_auth to 1.7.16 (exc)
better_auth better_auth to 1.8.0-beta.5 (exc)

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-362 The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

This vulnerability is a race condition in Better Auth versions before 1.7.16 and 1.8.0-beta.0 before 1.8.0-beta.5. It occurs when using MySQL or MariaDB with specific settings. The system retrieves a session ID via a separate query that may run on a different database connection. Under concurrent load, this can cause a user to receive another user's session, leading to unauthorized access and impersonation.

Detection Guidance

To detect this vulnerability, check if your system uses Better Auth with MySQL or MariaDB and the `advanced.database.generateId: "serial"` setting enabled. Monitor for concurrent session creation failures or mismatched user sessions during login attempts.

Impact Analysis

This vulnerability allows an attacker to gain unauthorized access to another user's session during concurrent operations like sign-ins or sign-ups. The attacker cannot choose which account they receive but may impersonate the affected user, potentially accessing sensitive data or performing actions on their behalf.

Compliance Impact

This vulnerability could lead to unauthorized access to personal or sensitive data, violating confidentiality requirements in GDPR and HIPAA. It may result in data breaches, non-compliance with data protection regulations, and potential legal consequences due to improper access controls.

Mitigation Strategies

Upgrade Better Auth and its adapters to versions 1.7.16 or 1.8.0-beta.5 or later. Alternatively, disable the `generateId: "serial"` setting in MySQL configurations to prevent the race condition.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-134313. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart

Security Radar

News mentioning this vulnerability
Loading related security news...