Status: Patched
This vulnerability has been verified as resolved and deployed.
Multi-session sign-out hook allows forged cookies to revoke arbitrary sessions
Summary
Multi-session sign-out hook allows forged cookies to revoke arbitrary sessions
The multiSession plugin's /sign-out after-hook (packages/better-auth/src/plugins/multi-session/index.ts) blindly trusts every cookie whose name matches the _multi- pattern. The handler splits the first segment of each raw cookie value and forwards the resulting strings to ctx.context.internalAdapter.deleteSessions(...) without ever calling ctx.getSignedCookie or verifying an HMAC.
Because the Cookie header is entirely attacker-controlled, any authenticated user who learns another account's plain session token (via logs, backups, or database reads) can forge a _multi-<victimToken> cookie, send it alongside their own session cookie, and coerce the hook into deleting the victim's session. No signing secret or adapter credentials are required; the only prerequisite is knowledge of the token bytes.
Status: Reproduced locally with Bun 1.3.0 using the exploit PoC below, which selects the correct /sign-out after-hook and demonstrates the forged-cookie flow against the current head of canary.
CVSS Score
Vulnerability Location
Sink-to-Source Analysis
Attacker-controlled Cookie header is read from the HTTP request during sign-out.
Cookie header is parsed into key/value pairs without validation.
The first segment of the forged cookie value is treated as a session token.
Collected tokens are submitted to the adapter, which deletes every referenced session.
The internal adapter treats the supplied strings as session tokens and removes matching records from the database.
Impact Analysis
Critical Impact
The victim is forcibly logged out and cannot refresh their session until they authenticate again. Attackers can iterate over every token they harvest, achieving cross-account denial of service and undermining authorization guarantees for all tenants using the plugin.
Attack Surface
Any Better-Auth deployment that enables the multiSession plugin (tested on repository better-auth, branch canary, Bun runtime via bun run --conditions better-auth-dev-source).
Preconditions
The attacker controls any authenticated session (their own account suffices) and can obtain another user's plain session token (log leakage, backups, or DB read access). No signing secret or adapter access is needed.
Proof of Concept
Environment Setup
Requirements: Node.js 18+, pnpm 9+, and Bun 1.3.0.
Install dependencies:
Target Configuration
Save the PoC below as force-signout.ts. It imports the real multiSession plugin, locates the /sign-out after-hook, and supplies forged _multi- cookie values while simulating a valid session cookie:
Exploit Delivery
Execute the PoC with Bun so the better-auth-dev-source condition resolves to the TypeScript sources:
Outcome
The script reproduces the attack locally against canary: the forged _multi- cookie is treated as genuine, and the adapter is instructed to delete the attacker-chosen token (TARGETTOKEN).
Expected Response:
