[GH-ISSUE #8900] Account enumeration via distinct error codes in checkPassword (utils/password.ts) #11228

Closed
opened 2026-04-13 07:34:24 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @alavesa on GitHub (Apr 1, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/8900

checkPassword throws CREDENTIAL_ACCOUNT_NOT_FOUND when no account exists and INVALID_PASSWORD when the password is wrong. An attacker can distinguish between valid and invalid accounts by observing the error code.

Impact: Account enumeration on the sign-in flow.

Note: Related to existing enumeration work in #5017 (OTP email) and #8096 (/change-email), but this is a separate code path in the credential sign-in flow.

Found by PatchPilots security audit.

Originally created by @alavesa on GitHub (Apr 1, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/8900 `checkPassword` throws `CREDENTIAL_ACCOUNT_NOT_FOUND` when no account exists and `INVALID_PASSWORD` when the password is wrong. An attacker can distinguish between valid and invalid accounts by observing the error code. **Impact:** Account enumeration on the sign-in flow. *Note: Related to existing enumeration work in #5017 (OTP email) and #8096 (/change-email), but this is a separate code path in the credential sign-in flow.* Found by [PatchPilots](https://github.com/alavesa/patchpilots) security audit.
GiteaMirror added the security label 2026-04-13 07:34:24 -05:00
Author
Owner

@alavesa commented on GitHub (Apr 7, 2026):

Thanks for the quick fix! This was found during a PatchPilots security audit (npx patchpilots security). Good to see it resolved.

<!-- gh-comment-id:4201398605 --> @alavesa commented on GitHub (Apr 7, 2026): Thanks for the quick fix! This was found during a PatchPilots security audit (npx patchpilots security). Good to see it resolved.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#11228