Home / patterns

Login and signup messages that reveal which accounts exist (account enumeration)

A developer at night in front of two monitors, one showing a simple email and password login form and the other a code editor, in a dim blue-lit room
Quick answer: AI-generated auth code often gives helpful but leaky answers: "No account with that email" on login, "Email already registered" on signup, a 404 for unknown users and a 401 for a wrong password, or a login that answers instantly for unknown emails and slowly for real ones. Each lets anyone check which emails have accounts in your app, which feeds phishing and password-guessing attacks.

Last updated November 17, 2026

Steps

  1. Test it yourself: try logging in with a real account and a wrong password, then with an email that doesn't exist. Compare the message, the HTTP status code and the response body in your browser's network tab.
  2. Return one generic login failure for both cases, for example "Invalid email or password", with the same status code and response shape.
  3. Keep timing similar: when the user isn't found, still run a password hash comparison (against a dummy hash) instead of returning early.
  4. On signup, don't say the email is taken. Show "Check your email to continue" and send the existing user a notice or sign-in link instead of a new-account email.
  5. Apply the same rule to password reset and "resend verification" endpoints (see our password reset page).
  6. Add rate limiting and bot protection on login, signup and reset, since generic messages alone don't stop high-volume guessing.
  7. Check your auth provider's settings. Some hosted auth tools have their own option to protect against enumeration; turn it on if available.

Why it matters

OWASP's Authentication Cheat Sheet says login, password recovery and account creation should respond with generic messages, whether or not the user ID or password is correct, and notes that different HTTP status codes or a faster "quick exit" for unknown users can still reveal whether an account exists. It recommends protections against automated attacks, such as rate limiting and CAPTCHA, alongside generic responses. MITRE tracks the timing and response differences as CWE-203 (Observable Discrepancy) and CWE-204 (Observable Response Discrepancy). A confirmed list of your users' emails makes targeted phishing and credential stuffing easier.

Sources

OWASP Cheat Sheet Series: Authentication Cheat Sheet — https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html

MITRE CWE-204: Observable Response Discrepancy — https://cwe.mitre.org/data/definitions/204.html

MITRE CWE-203: Observable Discrepancy — https://cwe.mitre.org/data/definitions/203.html

Related patterns

Found a problem you'd rather not fix yourself?

Tell us what's wrong. A StorenTech engineer reviews your app and replies with a fixed quote, so you know the cost before any work starts.

Get it fixed by StorenTech

Vibe Security Weekly

One email a week with new failure patterns and how to fix them.

By joining you agree we may email you this newsletter. See our privacy policy. Free. Unsubscribe anytime. We'll never sell your email.