In Cloudflare's WAF, how does leaked credentials detection protect a shop's login endpoint, and what does it leave to your own rules and origin?
answer
- a detection that fills fields
- hashed lookup against breach data
- field set depends on plan
- Exposed-Credential-Check header to the origin
basics
~20 sLeaked credentials detection finds usernames and passwords in requests, checks them against breached-credential data and fills fields such as cf.waf.credential_check.password_leaked. It blocks nothing itself: you challenge with a rule and let the origin force a reset.
solid answer
~50 sWhen it is on (by default on Free plans, switched on under Security **Settings** on paid plans), Cloudflare looks for credentials in the login formats of common web applications and in generic patterns. Enterprise customers can also add custom detection locations. The credentials are hashed and compared with known breach data, and the results go into fields. `cf.waf.credential_check.password_leaked` is on all plans and `cf.waf.credential_check.username_and_password_leaked` needs Pro or higher; the username, similar-pair and `cf.waf.auth_detected` fields need Enterprise. You act on these fields with a custom rule or a rate limiting rule. Cloudflare suggests **Managed Challenge** rather than Block, because a real user reusing a breached password matches too. The **Add Leaked Credentials Checks Header** managed transform adds `Exposed-Credential-Check` (for example `1` for a leaked pair, `4` for a leaked password) so the origin can prompt a reset. It replaces the deprecated Exposed Credentials Check ruleset.
code
plaintext · 1 line(cf.waf.credential_check.username_and_password_leaked and http.request.uri.path eq "/api/login")go deeper
Recall that the detection only sets fields, and that a rule plus the origin header do the protecting.
Explain the field set by plan, the Managed Challenge suggestion, and the Exposed-Credential-Check header values the origin reads.
Show how you verify the detection actually sees your login format, and why the origin must force a reset, not just the edge.
Weigh customer friction against takeover risk when choosing challenge versus block, and who owns the forced-reset flow.
## What the detection does **Leaked credentials detection** is a Cloudflare traffic detection aimed at account takeover. It runs on proxied requests and does three things: 1. **Finds credentials** in the request. Built-in rules cover the login formats of common web applications and generic authentication patterns. On Enterprise you can add **custom detection locations**, expressions such as `lookup_json_string(http.request.body.raw, "email")` that point at your own JSON or form fields. 2. **Checks them** against a database of breached passwords, breached usernames and breached username-password pairs. Passwords are hashed before the comparison, and Cloudflare states it does not store, log or retain plaintext end-user passwords. 3. **Fills fields** with the result. It does not block, challenge or log anything on its own. ## The fields and their plans | Field | Meaning | Plan | | --- | --- | --- | | `cf.waf.credential_check.password_leaked` | The password was previously leaked | All plans | | `cf.waf.credential_check.username_and_password_leaked` | The username-password pair was leaked | Pro or above | | `cf.waf.credential_check.username_leaked` | The username was leaked | Enterprise | | `cf.waf.credential_check.username_password_similar` | A similar pair was leaked | Enterprise | | `cf.waf.auth_detected` | Credentials were found in the request at all | Enterprise | On Free plans the detection is enabled by default. On paid plans you turn it on under Security **Settings**, filtered to **Detection tools**. ## Acting at the edge Because the detection only fills fields, protection comes from rules that read them: - **Paid plans**: Cloudflare's suggested custom rule matches `cf.waf.credential_check.username_and_password_leaked` and uses **Managed Challenge**. Scoping it to the login path keeps it focused. - **Free plans**: Cloudflare offers a rate limiting rule template that blocks IP addresses sending a leaked password more than five times in 10 seconds. - **Validating first**: Security Analytics shows how often the fields are true before you enforce anything. A rule with the *Log* action is the alternative on Enterprise. Why a challenge and not a block? A leaked credential in a request means one of two things. An attacker may be replaying a breached list, or a genuine customer may be reusing a password that leaked somewhere else. A Managed Challenge slows the automated case while letting the person through. Blocking would lock real customers out of checkout. Rate limits keyed on failed logins, and bot scoring, are covered in their own lessons; this detection supplies the signal they can combine with. ## Telling the origin The edge can only slow an attacker. The account owner still has a compromised password. Turn on the **Add Leaked Credentials Checks Header** managed transform, and the origin receives an `Exposed-Credential-Check` request header on matching requests: - `1`: a previously leaked username and password pair (Pro and above) - `2`: a previously leaked username (Enterprise) - `3`: a similar leaked username and password combination (Enterprise) - `4`: a previously leaked password (all plans) The application can then require a password change or step-up verification after a successful login. That is the only step that fixes the account itself. ## What changed and what to watch - The older **Cloudflare Exposed Credentials Check** managed ruleset is deprecated. Cloudflare recommends switching to leaked credentials detection and then turning the old ruleset off for latency. - If your login sends credentials under field names the built-in rules do not recognise, the fields may stay false. Test with Cloudflare's test credentials and check Security Analytics before relying on the rule. Custom locations need Enterprise. - The detection only sees traffic that passes through the proxy. A login endpoint reachable directly at the origin is unprotected, and closing that path belongs to the material on origin lockdown. ## A worked rollout for the shop's login For an e-commerce API whose login sits at `/api/login` on a Pro zone, a sensible order is: 1. Turn on **Leaked credential detection** under Security **Settings** > **Detection tools**. 2. Send Cloudflare's documented test credentials to the login and confirm in Security Analytics that the leaked-credentials fields come back true for them. 3. Watch how often real logins match over a few days. A steady trickle is usually password reuse, while a sudden spike from many addresses looks like a replayed breach list. 4. Deploy the custom rule on `cf.waf.credential_check.username_and_password_leaked` scoped to the login path, with **Managed Challenge**. 5. Turn on the managed transform and have the application read `Exposed-Credential-Check` and require a password change after a successful login. 6. Once this is working, switch the deprecated Exposed Credentials Check ruleset off if it is still deployed. If the mobile app cannot complete a challenge, pair the signal with a rate limiting rule on that route instead of a challenge, and rely on the origin-side reset.
- A team on the Pro plan keeps the deprecated Exposed Credentials Check ruleset after turning on leaked credentials detection. What should it do?Set up the mitigation rule on the new fields, check its matches, then turn the old ruleset off. Cloudflare recommends removing Exposed Credentials Check once leaked credentials detection and its rules are in place, for latency, and the new detection's fields can be used in both custom rules and rate limiting rules.
- Why would cf.waf.credential_check.password_leaked stay false for every login on a JSON API, even during a known stuffing wave?The built-in detection may not recognise the API's credential field names, so it never extracts a password to check. On Enterprise, add a custom detection location such as `lookup_json_string(http.request.body.raw, "password")`. On other plans, confirm with Cloudflare's test credentials whether the format is detected at all before relying on the fields.
- Turning on leaked credentials detection blocks compromised logins by itself.
- Every leaked-credentials field is available on the Free plan.
- Cloudflare stores the plaintext passwords it checks.
- Block is the recommended action for requests with leaked credentials.
- The Exposed Credentials Check ruleset is the current way to do this.
Assumes leaked credentials detection as of 2026-10-10; it replaced the Cloudflare Exposed Credentials Check managed ruleset, which is deprecated.