How to Check Whether Your Login Form Reveals Account Existence
A login form can reveal whether an account exists without explicitly saying “User found.” Different error messages, HTTP status codes or processing times can provide clues. A generic message on the screen alone is therefore insufficient. Below is a verification plan for developers and web product owners: what to compare, which results to accept and which fixes to prioritize. All examples are fictional, and the proposed checks are intended for your own test environment.
What a Failed Login Attempt Should Conceal
The purpose of this check is to ensure that the external response does not reveal whether the submitted account exists. The trust boundary lies between the server’s internal decision and what the client receives. The server distinguishes between reasons for rejection, but the response must remain generic at both the HTTP and HTML levels. An identical error page does not solve the problem if HTTP status codes reveal different reasons.
OWASP recommends a single message for invalid credentials, a nonexistent account, or an account that is locked or disabled. The main comparison in this plan is between an existing user with an incorrect password and an unknown user. If the product supports account locking and disabling, include these states when checking external error responses using your own test accounts.
Prepare a Fictional Example and Expected Result
Consider a completely fictional web product called “Listok.” In its own test environment, the team creates a synthetic account, reader-test, and reserves an identifier known not to exist, absent-test. Use a deliberately incorrect password for the first account and the same test value for the second. No real user data is needed for this check.
Suppose Listok currently responds with “Incorrect password” in the first case and “User not found” in the second. These responses directly distinguish an existing account from a nonexistent one. The target result for both cases is a generic message, such as “Unable to sign in: check your username and password,” without specifying the reason. The following checks are original editorial suggestions, not an official OWASP procedure.
Compare the Error Text and Actual HTTP Status Code
Perform both failed login attempts and record the interface message, response body and actual HTTP status code. Check each layer separately: identical text on a page can accompany different API responses. The acceptance criterion for the text is an identical generic message that does not indicate whether the user exists. The REST API response must also contain no stack traces or other internal technical clues.
For the REST API considered here, the acceptance criterion is that both attempts return 401. In the OWASP REST Security table, this code corresponds to an incorrect or missing identifier or password. Code 403 applies to a different situation: authentication succeeded, but permission to access the resource is missing. Do not choose between these codes based on whether the account exists. Record matching codes and matching text as two separate verification results.
Measure Timing and Review Server Branches
In your own environment, alternate between attempts for reader-test with an incorrect password and attempts for absent-test. Record response durations and measurement conditions to keep the comparison meaningful. The aim is to identify recurring differences and relate them to the implementation. Do not set an arbitrary threshold beyond which the form is declared secure: similar timing in a small sample remains an observation.
Separately review the server-side path for both errors. An early exit when a user does not exist can create a difference: the server immediately rejects an unknown user but continues processing the password for an existing user. In the OWASP example, following the same process regardless of the submitted data produces approximately equal response times. Any early exit or additional work found in only one branch should therefore become a concrete task to align processing.
Completion criteria for this part are reviewed branches, correction of the identified processing differences and a fresh set of recorded measurements. Even after a fix, similar measurements cannot be treated as proof that the responses are completely indistinguishable.
Check Password Comparison and Confirm the Actual Login Outcome
To compare a password with its stored hash, OWASP recommends using a secure function provided by the language or framework, where available. For a custom comparison function, constant execution time is specified separately. This requirement applies to the comparison, not the entire HTTP request. Checking one function does not replace reviewing the complete failed-authentication path.
Add a positive control: sign in to reader-test with the correct password and confirm the expected result—for example, that this specific synthetic user’s private area opens. After each failed attempt, verify that login did not succeed and the private area did not become accessible. A single HTTP response does not confirm that the intended state change was accepted or rejected. A successful login does not need to match failed attempts in text, status code or timing.
Set Priorities and Record Limitations
First, address explicit differences in external error responses: separate messages for nonexistent users, different HTTP status codes and internal technical details. Then fix the identified differences between server branches and check the password comparison function in use. After making changes, repeat the error comparisons and positive control to ensure that standardizing responses has not broken normal login.
In the report, separate confirmed results from limitations: which messages and codes matched, which branches were reviewed, the conditions under which timing was measured and what remains unchecked. This plan assesses disclosure of account existence through three selected signals, rather than the overall security of authentication. To review your implementation and prioritize fixes, you can get a free audit of your website or the web portion of your product.