GHSA-2vg6-77g8-24mp: Better Auth: Stale sessions persist after user deletion across admin, anonymous, and SCIM flows
A vulnerability in better-auth causes stale user sessions to persist after user deletion when using external session caches and the session is not stored in the database. This affects user deletion flows in the admin, anonymous, and SCIM plugins, allowing deleted users' sessions to remain valid until the session TTL expires (default 7 days). The issue is fixed in patched versions of better-auth and @better-auth/scim, which ensure sessions are deleted before user records. Workarounds include enabling session storage in the database or explicitly revoking sessions in code. The impact is limited to session persistence post-deletion, with no known exploits in the wild.
AI Analysis
Technical Summary
When better-auth is configured with secondaryStorage (e.g., Redis) and session.storeSessionInDatabase is false (default), user deletion endpoints in admin, anonymous, and SCIM plugins fail to delete user sessions before deleting the user record. As a result, session payloads cached in secondary storage remain valid until their TTL expires, allowing deleted users to authenticate during that window. The vulnerability affects versions >=0.3.4 <1.6.11 and >=1.6.0 <1.6.11. The fix involves modifying these endpoints to call deleteSessions(userId) before deleteUser(userId). Workarounds include enabling session storage in the database or explicitly revoking sessions via API calls. This vulnerability corresponds to CWE-459, CWE-613, and CWE-672.
Potential Impact
Deleted users retain valid sessions in external caches for up to the session TTL (default 7 days), allowing continued access to resources with their previous permissions. This undermines user deprovisioning, especially in SCIM-driven offboarding scenarios, where active sessions are not revoked immediately. No known exploits have been reported in the wild. The severity is low due to the requirement of authenticated privileges to delete users and the limited window of session persistence.
Mitigation Recommendations
A fix is available in patched versions of better-auth and @better-auth/scim that ensure sessions are deleted before user records. Users should upgrade to these patched versions as soon as possible. If immediate upgrade is not feasible, workarounds include setting session.storeSessionInDatabase to true to leverage database cascades for session deletion, or explicitly revoking user sessions via API calls (auth.api.revokeUserSessions) in admin, SCIM, and anonymous user deletion flows. These mitigations eliminate the stale session persistence gap.
GHSA-2vg6-77g8-24mp: Better Auth: Stale sessions persist after user deletion across admin, anonymous, and SCIM flows
Description
A vulnerability in better-auth causes stale user sessions to persist after user deletion when using external session caches and the session is not stored in the database. This affects user deletion flows in the admin, anonymous, and SCIM plugins, allowing deleted users' sessions to remain valid until the session TTL expires (default 7 days). The issue is fixed in patched versions of better-auth and @better-auth/scim, which ensure sessions are deleted before user records. Workarounds include enabling session storage in the database or explicitly revoking sessions in code. The impact is limited to session persistence post-deletion, with no known exploits in the wild.
CVSS v3.1
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
When better-auth is configured with secondaryStorage (e.g., Redis) and session.storeSessionInDatabase is false (default), user deletion endpoints in admin, anonymous, and SCIM plugins fail to delete user sessions before deleting the user record. As a result, session payloads cached in secondary storage remain valid until their TTL expires, allowing deleted users to authenticate during that window. The vulnerability affects versions >=0.3.4 <1.6.11 and >=1.6.0 <1.6.11. The fix involves modifying these endpoints to call deleteSessions(userId) before deleteUser(userId). Workarounds include enabling session storage in the database or explicitly revoking sessions via API calls. This vulnerability corresponds to CWE-459, CWE-613, and CWE-672.
Potential Impact
Deleted users retain valid sessions in external caches for up to the session TTL (default 7 days), allowing continued access to resources with their previous permissions. This undermines user deprovisioning, especially in SCIM-driven offboarding scenarios, where active sessions are not revoked immediately. No known exploits have been reported in the wild. The severity is low due to the requirement of authenticated privileges to delete users and the limited window of session persistence.
Mitigation Recommendations
A fix is available in patched versions of better-auth and @better-auth/scim that ensure sessions are deleted before user records. Users should upgrade to these patched versions as soon as possible. If immediate upgrade is not feasible, workarounds include setting session.storeSessionInDatabase to true to leverage database cascades for session deletion, or explicitly revoking user sessions via API calls (auth.api.revokeUserSessions) in admin, SCIM, and anonymous user deletion flows. These mitigations eliminate the stale session persistence gap.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-2vg6-77g8-24mp
- Osv Schema Version
- 1.4.0
- Aliases
- []
- Ecosystems
- ["npm"]
- Database Specific Severity
- LOW
- Cvss Version
- 3.1
Threat ID: 6a4e4ef7c9d9e3dbe328cbf7
Added to database: 07/08/2026, 13:21:59 UTC
Last enriched: 07/08/2026, 13:44:10 UTC
Last updated: 07/09/2026, 01:03:35 UTC
Views: 5
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.