How Cloudflare protects endpoints where credentials are passed in the request body.
Rate limit by the username value extracted from the form body. This catches
distributed password spraying where an attacker uses many different IPs to target the same account.
Rule matching expression:
# Match POST to login endpoint with a password in the body
http.request.uri.path eq "/login" and
http.request.method eq "POST" and
http.request.body.form["password"] ne ""
Counting characteristic (track rate per username):
http.request.body.form["username"]
Password spraying is almost always automated. Bot Management assigns a score of 1–99 to each request. Block or challenge low-scoring requests (hydra, Burp Intruder, scripted curl loops, etc.) at the login endpoint.
# Block automated requests hitting the login page
http.request.uri.path eq "/login" and
cf.bot_management.score lt 30
Docs: Bot Scores — Bot Management Plans
Use WAF custom rules to inspect the body and block requests matching a specific password pattern, known default passwords, or malformed login requests (missing fields).
Match a specific password format with regex:
# Example: block if password matches a known weak pattern
http.request.uri.path eq "/login" and
http.request.body.form["password"] matches "^[a-z0-9]{8}$"
Block malformed requests (missing password field):
http.request.uri.path eq "/login" and
http.request.method eq "POST" and
not http.request.body.form["password"] ne ""
Docs: WAF Custom Rules
Cloudflare automatically checks submitted credentials against known breached credential databases.
Use the cf.waf.credential_check.* fields to detect and act on compromised passwords.
# Block or challenge requests with a known leaked password
cf.waf.credential_check.username ne "" and
cf.waf.credential_check.password_leaked eq true
Docs: Leaked Credential Check
application/x-www-form-urlencoded)username parameter in the POST body. Used as a
rate-limiting characteristic to track per-account attempts.
password parameter. Used in rule expressions to
match, inspect, or pattern-match the submitted password.
| Layer | Tool | What It Catches | Required Plan |
|---|---|---|---|
| 1 | Advanced Rate Limiting (per username in body) | Volume-based spraying, distributed IPs targeting the same account | Enterprise + Advanced Rate Limiting |
| 2 | Bot Management | Automated tools (hydra, Burp Intruder, scripts, headless browsers) | Enterprise + Bot Management |
| 3 | WAF Custom Rules | Body pattern matching, malformed requests, known password formats | Pro / Business / Enterprise |
| 4 | Leaked Credential Check | Credentials matching known breached databases | Enterprise + WAF add-on |