Staging Environment: Content and features may be unstable or change without notice.
Search for packages
Package details: pkg:npm/better-auth@1.2.10
purl pkg:npm/better-auth@1.2.10
Next non-vulnerable version 1.4.9
Latest non-vulnerable version 1.6.11
Risk 4.5
Vulnerabilities affecting this package (4)
Vulnerability Summary Fixed by
VCID-hv9u-qvqb-c3by
Aliases:
GHSA-xg6x-h9c9-2m83
Better Auth Has Two-Factor Authentication Bypass via Premature Session Caching (session.cookieCache) ### 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.
1.4.9
Affected by 0 other vulnerabilities.
VCID-wvwj-npt5-qye2
Aliases:
GHSA-x732-6j76-qmhm
Better Auth's rou3 Dependency has Double-Slash Path Normalization which can Bypass disabledPaths Config and Rate Limits
1.4.5
Affected by 1 other vulnerability.
VCID-xcfr-utg2-u7a8
Aliases:
CVE-2025-61928
GHSA-99h5-pjcv-gr6v
Better Auth is an authentication and authorization library for TypeScript. In versions prior to 1.3.26, unauthenticated attackers can create or modify API keys for any user by passing that user's id in the request body to the `api/auth/api-key/create` route. `session?.user ?? (authRequired ? null : { id: ctx.body.userId })`. When no session exists but `userId` is present in the request body, `authRequired` becomes false and the user object is set to the attacker-controlled ID. Server-only field validation only executes when `authRequired` is true (lines 280-295), allowing attackers to set privileged fields. No additional authentication occurs before the database operation, so the malicious payload is accepted. The same pattern exists in the update endpoint. This is a critical authentication bypass enabling full an unauthenticated attacker can generate an API key for any user and immediately gain complete authenticated access. This allows the attacker to perform any action as the victim user using the api key, potentially compromise the user data and the application depending on the victim's privileges. Version 1.3.26 contains a patch for the issue.
1.3.26
Affected by 3 other vulnerabilities.
VCID-z32n-9h42-cbd3
Aliases:
GHSA-569q-mpph-wgww
Better Auth affected by external request basePath modification DoS
1.4.2
Affected by 2 other vulnerabilities.
Vulnerabilities fixed by this package (1)
Vulnerability Summary Aliases
VCID-wq9k-qm9f-h3aa Better Auth is an authentication and authorization library for TypeScript. An open redirect has been found in the originCheck middleware function, which affects the following routes: /verify-email, /reset-password/:token, /delete-user/callback, /magic-link/verify, /oauth-proxy-callback. This vulnerability is fixed in 1.2.10. CVE-2025-53535
GHSA-36rg-gfq2-3h56