How to Reject Common and Compromised Passwords
During registration and password changes, a web product can reject values found in lists of common or previously compromised passwords. OWASP recommends this check to help prevent users from choosing common values or values already known to attackers. The developer’s task is to apply one server-side policy across every password-setting path and verify what is actually saved. We will walk through implementation using an entirely fictional service, test accounts you own, and a controlled training list.
What the Check Should Reject
The central mechanism compares a new password against a list of blocked values before saving it. If there is a match, the proposed value is not set. No match allows validation to continue under the product’s other rules, but does not by itself prove that the password is secure.
Avoid describing every rejection as ‘the password is too weak’: here, the specific reason is known—a match against the list. In the proposed implementation, the message could say: ‘This password is on the blocked list. Choose another.’ This describes the check’s result without promising account security.
Where the Trust Boundary Lies
Implement a shared server-side check called by registration, password changes, and the existing account recovery flow. The trust boundary lies between receiving the new value and saving it. The proposed sequence is straightforward: receive the value, apply the shared policy, and allow saving only after validation succeeds. An interface hint is not evidence that this server-side check has run.
For password changes, OWASP specifies an active session for an authenticated user and verification of the current password. Passwords set after recovery should follow a secure policy consistent with the rest of the application. In this scenario, ordinary login does not become an additional point for checking existing passwords against the list.
Choosing Data for the Check
Pwned Passwords lets you check whether a password appears among previously compromised values. Its database can be downloaded and hosted independently. This is one option for supplying data to the rejection mechanism; the hosting choice does not change the requirement to check before saving.
OWASP does not guarantee that other available lists of popular passwords are up to date. Assess two questions separately: whether the check runs across every required path, and what information the chosen list contains. The training set below addresses only the first question. It cannot establish that compromise data is complete.
A Fictional Example and Registration Checks
Imagine an entirely fictional service called ‘Draft’, owned by your team. Create test accounts you own for these checks. Add the synthetic value ‘Demo-Blocked-River-47!’ to a controlled training list. Separately, prepare ‘Demo-Accepted-Meadow-82!’, which is absent from that list. These are fictional test values: we do not claim that either has appeared in a real breach.
The following are original editorial acceptance tests, not an official OWASP procedure. First, register an account with an allowed value outside the list that satisfies the service’s other rules. Acceptance criterion: the account is created, and the password that was set allows login. Then submit a value from the training list in a separate registration attempt. Rejection criterion: it is rejected and not set; attempting to log in with it does not grant access to the corresponding test account. A message or HTTP response alone is insufficient evidence.
Verifying Rejection During a Password Change
Using a test account you own, with an active session and the correct current password, try to set a value from the training list. The expected result is rejection before saving. Then verify the account’s state: the previous password still works, and the rejected new password does not. This checks that no replacement occurred, rather than merely checking that an error appeared.
Next, run a positive control: set an allowed value outside the list and verify that the new password works and the previous one no longer does. These login checks observe the result of saving. They do not introduce list checks for existing passwords during ordinary authentication.
Recovery and the Order of Fixes
Repeat both controls through the existing recovery flow for a test account you own, after completing the required identity verification. A value from the same list should be rejected without replacing the previous password: the previous one works, and the rejected one does not. An allowed value outside the list should be accepted and work after it is set.
First, fix paths that save a value despite a match against the list. Then consolidate separate implementations into a shared server-side policy and repeat the registration, password change, and recovery checks. If the interface reports rejection but the password changes, the test fails. If the system also rejects the allowed control, the mechanism’s correct operation has not been established either.
What the Results Establish and What Needs Further Review
Passing these tests confirms the observed behavior with the selected data you own. It does not prove that the list is complete or provide a statistical guarantee of security. This article is limited to checking a new password before saving it. Password length, Unicode, input truncation, hash updates, login lockout, and concealing account existence are not covered here. Recovery link lifecycles, session revocation, and MFA replacement also remain outside the scope.
To check how this policy is applied in your product, you can request a free website or web-product audit. The review focuses on consistency across password-setting paths and the actual account state after a new value is accepted or rejected.