skip to content

Managed WAF Rules

The Cloudflare Managed Ruleset and the OWASP Core Ruleset block known attack patterns. Interviewers ask how to roll one out without blocking real users, tune it and add exceptions.

on this pageshow

explore

questions

6

In Cloudflare's WAF, what does the attack score in cf.waf.score measure, and how should a team start acting on it?

level: middleimportance: should knowfreq 30%

answer

  1. machine learning, not signatures
  2. low number means likely attack
  3. four classes from attack to clean
  4. a detection needs a rule to act

basics

~20 s

WAF attack score is a machine-learning detection that gives each request a score from 1 (almost certainly malicious) to 99 (likely clean), catching modified payloads that miss signatures. It acts only through a rule, so start with a strict threshold such as 20.

solid answer

~40 s

Attack score complements the managed rulesets. Signatures catch known payloads, and the model also scores variants an attacker has altered to slip past them. `cf.waf.score` runs from 1 to 99, where **lower means more likely malicious**. There are per-vector scores in `cf.waf.score.sqli`, `cf.waf.score.xss` and `cf.waf.score.rce`, and 100 marks a request the system chose not to score. The full fields need Enterprise. Business plans get only `cf.waf.score.class` (`attack`, `likely_attack`, `likely_clean`, `clean`). It is a **detection**: it fills fields and blocks nothing until a custom rule or rate limiting rule uses it. Cloudflare's suggested start is a rule on `cf.waf.score le 20`, watched for a few days (with Log on Enterprise), then moved to Managed Challenge or Block. Blocking everything below 50 catches legitimate requests.

code

plaintext · 1 line
plaintext
cf.waf.score le 20

go deeper

for a junior

Recall the scale's direction, 1 likely malicious and 99 likely clean, and that the score only acts through a rule.

for a middle

Explain the four classes and their ranges, the per-vector fields, the 100 and 0 special values, and which plan gets which field.

for a senior

Show a staged rollout from a strict threshold to enforcement, and how a scoped attack score rule backs up a managed-rules exception.

for a principal

Judge where machine-learning scoring replaces signature tuning effort, and where a business case for the Enterprise fields holds up.

## What the score is Cloudflare's **WAF attack score** is a traffic **detection**. A machine-learning model looks at each request and estimates how likely it is to be an attack. Its job is to cover a gap in signature matching: - The **Cloudflare Managed Ruleset** matches known attack signatures and has a very low false-positive rate. - Attackers change known payloads (re-encoding, fuzzing, reordering) so they no longer match a signature exactly. - The attack score model rates those variants too. Cloudflare recommends running **both** managed rules and attack score. The system automatically detects and decodes Base64, JavaScript Unicode escape sequences and URL-encoded content anywhere in the URL, headers and body. ## Reading the numbers The direction surprises people who know the OWASP Core Ruleset, where a higher threat score is worse. Here **a low score means a likely attack**: | Value | Meaning | | --- | --- | | `1`–`20` | class `attack` | | `21`–`50` | class `likely_attack` | | `51`–`80` | class `likely_clean` | | `81`–`99` | class `clean` | | `100` | reached the system but was not scored (shown as *Unscored*; not usable as a class in expressions) | | `0` | Logpush only: the request never reached the scoring stage, for example because an earlier rule mitigated it | The fields are: - `cf.waf.score`: the global score, derived from the per-vector scores but **not** their sum. - `cf.waf.score.sqli`, `cf.waf.score.xss`, `cf.waf.score.rce`: SQL injection, cross-site scripting and command injection or remote code execution. - `cf.waf.score.class`: the class string from the table above. ## Plans - **Enterprise**: all numeric fields and the class. - **Business**: only `cf.waf.score.class`. - **Free and Pro**: no attack score. ## Why it blocks nothing by itself Like other detections, attack score only **populates fields**, visible as filters in Security Analytics. Nothing happens to traffic until a **custom rule** or a **rate limiting rule** uses a field in its expression. The managed rulesets are different: they come with actions. The attack score needs a rule you write. Writing and ordering those rules is covered in the lesson on custom rules. ## A safe first rule Cloudflare's own rollout guidance runs in three steps: 1. **Create a strict rule.** On Enterprise, `cf.waf.score le 20`. On Business, `cf.waf.score.class eq "attack"`. 2. **Monitor it** for the first few days in Security Events, checking that the threshold fits your traffic. Enterprise customers can start with the *Log* action, which Cloudflare's actions reference lists as Enterprise-only. 3. **Tighten the action** to *Managed Challenge* or *Block* once matches look right. Cloudflare advises against blocking every request below 50 on the score alone, because the `likely_attack` band (21–50) includes legitimate requests. To catch more of that band, combine a higher threshold with other conditions, such as a sensitive URI path, or a bot score where Bot Management is available. ## Where it fits beside the rulesets - On an endpoint where a managed-rules exception skips noisy rules, for example a rich-text save, a strict attack score rule can still act on requests the model rates as clear attacks, so the carve-out does not leave the path unwatched. Check first that the endpoint's legitimate requests stay out of that band. - Attack score and **bot score** answer different questions. Attack score asks whether the request content looks like an attack. Bot score asks whether a person or an automated client sent it. The bot material covers the latter. - A request mitigated in an earlier phase may never be scored, so read a `0` in logs as "not reached", not as "malicious". ## Looking before writing the rule Because detections populate fields whether or not a rule uses them, you can study the score on real traffic before you enforce anything: - In **Security Analytics**, which shows all incoming requests and not only the ones a security feature acted on, filter by the attack score class or a score range and see which paths and clients land in the `attack` band. - Compare that band with what the managed rulesets already mitigate. Requests in the `attack` class that no managed rule matched are the extra coverage the score buys you. - Look for legitimate patterns that score low, such as admin forms posting markup or code snippets, before a rule starts challenging them. - From the filtered view, the dashboard offers **Create custom security rule**, which turns the current filters into a rule expression you can review before you deploy it. This look-first habit is what keeps a strict threshold from turning into a support queue on launch day.

  • Logpush records show cf.waf.score values of 0 on some requests. Were those attacks?
    No. In Logpush a `0` means the request never reached the attack score stage, for example because a custom rule or DDoS protection had already mitigated it. It does not appear in the dashboard. A `100` is different again: the request reached the system and was deliberately left unscored.
  • How does attack score help on a path where a managed-rules exception skips some OWASP rules?
    The exception stops the skipped rules from scoring that endpoint's legitimate markup, but the attack score is still computed for the request. A strict custom rule such as `cf.waf.score le 20`, scoped to the same path, keeps acting on requests the model rates as clear attacks, once you have checked that the endpoint's legitimate saves do not score that low.

  • A high cf.waf.score means the request is probably an attack.
  • The global attack score is the sum of the SQLi, XSS and RCE scores.
  • Turning on attack score detection blocks attacks automatically.
  • Blocking every request scoring below 50 is the recommended starting rule.
  • Business plans can write rules on the numeric cf.waf.score field.
open as a page

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?

level: middleimportance: should knowfreq 30%

basics

~20 s

Leaked 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.

open as a page

In Cloudflare's WAF managed rulesets, how does an override differ from an exception (a skip rule), and which wins when both apply?

level: middleimportance: should knowfreq 40%

basics

~20 s

An override changes how managed rules behave for every request the deployment covers: their action or whether they are enabled. An exception is a separate skip rule that bypasses chosen rules or rulesets only for matching requests. Exceptions take priority over overrides.

open as a page

In Cloudflare's WAF, how do the Cloudflare Managed Ruleset and the Cloudflare OWASP Core Ruleset differ in how they decide to act?

level: middleimportance: should knowfreq 42%

basics

~20 s

The Cloudflare Managed Ruleset matches signatures, and each matching rule applies its own action. The OWASP Core Ruleset adds the scores of matching rules into a threat score and acts only when that total reaches the threshold.

open as a page

After a Cloudflare zone turned on the managed WAF rulesets, admins saving rich-text product descriptions through the API are blocked; how do you find which rules fired and fix it narrowly?

level: seniorimportance: should knowfreq 38%

basics

~20 s

Filter Security Events to the save endpoint and read the rule. Rule 949110 means the OWASP threat score crossed its threshold, so open Additional logs for the contributing rules. Then add an exception skipping only those rules for that host, path and method.

open as a page

As security lead, how would you roll out Cloudflare's managed WAF rulesets on a live checkout and API, and who should own the exceptions afterwards?

level: principalimportance: should knowfreq 32%

basics

~20 s

Deploy the Cloudflare Managed Ruleset first and watch Security Events before enforcing: in Log on Enterprise, or scoped and challenged elsewhere. Add OWASP only if it earns its false positives. Exceptions go through one owner, stay narrow and get reviewed.

open as a page