Executive brief
Better Auth is a security library used by developers to handle user logins and permissions in TypeScript applications. A flaw in its device authorization feature allows a logged-in attacker to hijack another user's login process if they can obtain a temporary device code (e.g., through screen sharing or shoulder surfing). This could result in the attacker gaining control over the session on the victim's device or preventing the legitimate user from logging in.
Technical details
An authorization bypass exists in the Better Auth deviceAuthorization plugin due to improper ownership validation. The 'GET /device' endpoint fails to claim the pending device code row for the authenticated session, and the 'POST /device/approve' and 'POST /device/deny' endpoints short-circuit their ownership checks when the 'userId' field is NULL. An authenticated attacker who obtains a valid 'user_code' can exploit this to bind their own account to the victim's polling device. The vulnerability is fixed in version 1.6.11 by ensuring 'GET /device' claims the row and enforcing strict session-to-owner equality in subsequent requests.
Affected products
- better-auth better-auth >= 1.6.0, < 1.6.11
Timeline
- 2026-05-12: patched: Fix merged in PR #9573 and released in v1.6.11
- 2026-05-31: advisory: GitHub Security Advisory GHSA-cq3f-vc6p-68fh published
- 2026-07-15: disclosed: CVE-2026-45337 published to NVD