Better Auth Has Two-Factor Authentication Bypass via Premature Session Caching (session.cookieCache)
Key facts
- Attack vector
- —
- Privileges required
- —
- User interaction
- —
- Attack complexity
- —
- Impact type
- Security bypass
- Confidentiality · integrity · availability
- —
- Fix status
- Fixed
No CVSS vector from any source. Fix status from GitHub. Impact type from CWE-288.
Summary
### Summary Under certain configurations, sessions may be considered valid before two-factor authentication (2FA) is fully completed. This can allow access to authenticated routes without verifying the second factor. --- ### Description When two-factor authentication is enabled, the authentication flow correctly identifies users who require additional verification and defers full authentication until the second factor is completed. However, when `session.cookieCache` is enabled, the session generated during the initial sign-in step may be cached as valid **prior to 2FA verification**. Subsequent session lookups may then return this cached session without re-evaluating the 2FA requirement. This results in a situation where session validity can be established before all authentication constraints are satisfied. --- ### Impact An attacker (or user) with valid primary credentials may gain access to protected application routes without completing the required second authentication factor. Any application using `better-auth` with both two-factor authentication and session cookie caching enabled may be affected. --- ### Mitigation * Upgrade to a version of `better-auth` that includes the fix for this issue. * Ensure that session caching does not treat sessions as fully authenticated until all required authentication steps, including 2FA, are completed. * As a temporary workaround, disable `session.cookieCache` when using two-factor authentication.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | better-auth (npm) | before 1.4.9 | 1.4.9 | Patch available | GHSA-xg6x-h9c9-2m83 |
- better-auth (npm) Vendor— Affected before 1.4.9 Fixed in 1.4.9 Patch available GHSA-xg6x-h9c9-2m83
Remediation
- Fix · GHSA-xg6x-h9c9-2m83 better-auth (npm) Fixed in 1.4.9 Advisory →
Timeline
- 2026-10-03 Threatist record created from GHSA-xg6x-h9c9-2m83
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences