User enumeration: when a response says which accounts exist
User enumeration, also called account enumeration, is a weakness in which a sign-in, sign-up or password recovery page behaves differently for accounts that exist and accounts that do not. Nobody has to break in. The page itself says which usernames and email addresses are real, one request at a time.
Quick facts
- Also called
- Account enumeration, username enumeration, username harvesting
- Test guide
- OWASP WSTG-IDNT-04, Testing for Account Enumeration and Guessable User Account
- OWASP category
- A07:2025 Authentication Failures
- Where it shows
- Sign-in, registration, password recovery
- Signals
- Message text, status code, redirect, page title, response length, response time
- Main fix
- One generic answer, in the same time, for every outcome
The signals above are those the OWASP Web Security Testing Guide lists for this test. The remedy follows the OWASP Authentication Cheat Sheet, which asks for a generic response, "both HTTP and HTML", whether or not the account exists.
Why a list of valid accounts matters
A single leaked fact, that an address has an account here, looks small. It starts an attack rather than finishing one, and every later step gets cheaper once the attacker knows which names are real.
Guessing passwords against names that do not exist wastes effort, so a list of confirmed accounts narrows brute force attacks to targets worth the attempt. It also tells someone running credential stuffing which entries from an old breach are worth trying here. Beyond automation, the fact itself can be sensitive: a confirmed address on a clinic portal or a dating service says something about a person even if no password ever falls.
The OWASP cheat sheet makes the dependency explicit: protection against brute-force attacks is also effective against enumeration "because it prevents an attacker from applying the enumeration at scale". That is a statement about scale, not about the leak. The leak stays until the responses match.
Where responses give accounts away
Three flows tend to leak, because each has to answer a question about a specific person. In each, the unsafe version tells the truth and the safe version tells the same story either way.
Sign-in
The classic leak is two error messages: one for a wrong password and another for an unknown user. The cheat sheet gives the pair "Login failed, invalid user ID" and "Login failed; account disabled" as incorrect, and "Login failed; Invalid user ID or password" as correct. A locked or disabled account must read the same as the other two cases.
Registration
A sign-up form that answers "this user ID is already in use" confirms an account to anyone who tries the address. The cheat sheet's alternative is a neutral message that a link to activate the account has been emailed to the address provided. The person who owns the address learns the truth in their inbox; a stranger learns nothing.
Password recovery
Recovery is the most talkative flow, because the natural reply is "we sent you a link" or "no such address". The cheat sheet marks both as incorrect and recommends one sentence for all cases: if that email address is in the database, an email to reset the password will be sent. The same applies to any "forgot username" form.
Signals outside the text
Wording is only the visible part. The testing guide also lists differing HTTP status codes, redirect targets and URL parameters, page titles and the size of the response. The cheat sheet adds a plain example: a service that answers 200 for a positive result and 403 for a negative one has told the client the answer without a word of text. Error output counts too, since "error disclosure" can serve as a discrepancy factor. The same holds for API authentication endpoints, where a status code or a field in a JSON error is read by a program, not a person, and differences are easier to compare.
Timing and size
A page can show identical text and still answer at different speeds. The cheat sheet explains the usual cause: the business logic does different work depending on the outcome, so the response time differs for the same error. Typical examples are checking a password hash only when the account exists, or sending an email only when it does. The testing guide notes that a backend action such as sending a reset message can add several hundred milliseconds, which is enough to tell the cases apart when many requests are compared.
The fix the cheat sheet describes is to run the same process whatever the user or password is. In practice that means doing the comparison against a placeholder value when the account is missing, and handing mail to a queue so that the request does not wait for it. Response size matters in the same way: if the "found" page carries one more line of text, the length is a signal.
These differences are small, and noise hides some of them. Do not read that as safety. Treat equal work as the target and measure it on your own system, rather than assuming that a gap is too small to notice.
When a generic answer is hard
Some products cannot hide who exists. A forum with public profile pages or a marketplace with seller names shows its accounts by design; the testing guide itself notes that applications may reveal usernames through misconfiguration or by design. A sign-up form that wants an instant "that name is taken" for a public handle is the same trade.
The cheat sheet's guidance for such features is practical. Where a generic error message cannot be returned, apply a CAPTCHA to the feature, as a defence-in-depth control and not a cure, and throttle repeated tries. The honest framing is a decision: this field is public, so it is protected against bulk probing rather than against a single lookup. Separate the public handle from the sign-in identifier, and the leak shrinks to something you chose.
Where a WAF helps and where it does not
A WAF sees requests. It can recognise that one client is hitting the sign-in or recovery path far more often than a person would, and it can apply a limit to that path. What it cannot see is meaning. It does not know which of your replies means "this account exists", and it cannot make two replies identical. That change belongs in the code that builds the response.
Rate limits are the useful part. They make enumeration slow and noisy, which is the effect the cheat sheet describes, and they work together with the rate limiting already set for the domain. Choosing what a limit counts matters: a limit per address is easy to sidestep, and one per target account protects that account but not the list. The trade-offs are in rate limiting by IP, user or key. A client that stays beneath the limit, or spreads its tries across many addresses, still sees every difference. Slow, spread-out probing of this kind is also how password spraying avoids per-account thresholds.
The three modes apply as for any rule. In off nothing is inspected. In monitor the limit and matching requests are recorded and every request is still served, so the activity log shows how much traffic the sign-in and recovery paths receive and from where before anything is refused. In block requests over the limit are refused and recorded. Start with monitor on these paths, read the log, then enforce.
None of this replaces fixing the responses. For the wider picture of what limits do and where they stop, see authentication failures.
How to prevent user enumeration
- One message for every sign-in failure. Unknown user, wrong password, locked and disabled accounts all read "invalid user ID or password".
- Same status, redirect and page. Return one status code and one template for all outcomes, including titles, hidden fields and URL parameters.
- Say the result by email. For registration and recovery, show a neutral message and send the real outcome to the address.
- Do equal work. Check a placeholder hash when the account is missing and send mail asynchronously, so time does not differ.
- Throttle and watch. Limit tries on sign-in, sign-up and recovery, and keep the log for review. What follows a confirmed account is covered under account takeover.
- Test it. Compare responses for a known and an unknown account across all three flows, against your own staging system, and re-run after template changes.
Questions
What is user enumeration?
User enumeration, also called account enumeration, is a weakness in which a login, sign-up or password reset page responds differently for accounts that exist and accounts that do not, so an attacker can build a list of valid usernames or email addresses.
How do attackers tell whether an account exists?
They compare responses: the wording of an error message, the HTTP status code, a redirect or page title, the size of the page, or the time the server takes to answer. Any consistent difference between a known account and an unknown one is enough.
How do you prevent user enumeration?
Return the same message, status code and page for every outcome of sign-in and password recovery, keep the response time the same by doing equal work for existing and missing accounts, tell the person the result by email instead of on the page, and limit how fast one client can try.
Does rate limiting stop user enumeration?
Rate limiting slows enumeration and makes it expensive at scale, but it does not remove the leak. A client that stays under the limit, or spreads its tries across many addresses, still sees the difference, so the responses themselves must be identical.
Can a WAF stop user enumeration?
Not by itself. A WAF can count and limit requests to sign-in and recovery paths and record them, but it does not know which of your responses reveals an account. Making the responses identical is a change in the application.