PT-2026-67314 · Unknown · Better Auth+1
CVSS v4.0
5.1
Medium
| Vector | AV:N/AC:L/AT:N/PR:H/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N |
Name of the Vulnerable Software and Affected Versions
better-auth versions prior to 1.6.11
@better-auth/scim versions prior to 1.6.11
Description
When
secondaryStorage is configured and storeSessionInDatabase is set to false, certain user-deletion processes fail to remove cached sessions. This occurs because the internalAdapter.deleteUser(userId) function is called without first invoking internalAdapter.deleteSessions(userId), leaving the session payload in secondary storage. Consequently, session tokens for deleted users remain valid until the session Time To Live (TTL) expires, which is seven days by default, allowing unauthorized authentication and access to read and write surfaces.The issue affects the following components:
- The
adminplugin when callingauth.api.removeUser(...)orauthClient.admin.removeUser(...). - The
anonymousplugin via the/delete-anonymous-userendpoint or the after-link hook. - The
@better-auth/scimplugin via theDELETE /scim/v2/Users/:userIdendpoint.
Recommendations
Upgrade better-auth to version 1.6.11 or later.
Upgrade @better-auth/scim to version 1.6.11 or later.
Set
session.storeSessionInDatabase to true to ensure database cascades remove sessions.
When using auth.api.removeUser, manually call auth.api.revokeUserSessions({ body: { userId } }).
For SCIM deprovisioning, call auth.api.revokeUserSessions(...) after the SCIM DELETE operation.
In the onLinkAccount hook for anonymous users, explicitly call internalAdapter.deleteSessions(anonymousUser.user.id) before issuing a new session.Exploit
Fix
Insufficient Session Expiration
Found an issue in the description? Have something to add? Feel free to write us 👾
Related Identifiers
Affected Products
@Better-Auth/Scim
Better Auth