Skip to content

Commit 78ea89a

Browse files
pedrosousaharshil1712
authored andcommitted
[WAF] Update attack score (#18415)
1 parent 05071b5 commit 78ea89a

File tree

2 files changed

+39
-20
lines changed

2 files changed

+39
-20
lines changed

src/content/docs/ruleset-engine/rules-language/fields/dynamic-fields.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,25 +436,25 @@ For more details, refer to [Malicious uploads detection](/waf/detections/malicio
436436

437437
`cf.waf.score` <Type text='Number' />
438438

439-
A global score from 1 to 99 that combines the score of each WAF attack vector into a single score. This is the standard [WAF attack score](/waf/detections/attack-score/) to detect variants of attack patterns.
439+
A global score from `1` to `99` that combines the score of each WAF attack vector into a single score. This is the standard [WAF attack score](/waf/detections/attack-score/) to detect variants of attack patterns.
440440

441441
## `cf.waf.score.sqli`
442442

443443
`cf.waf.score.sqli` <Type text='Number' />
444444

445-
An attack score from 1 to 99 classifying the SQL injection (SQLi) attack vector.
445+
An attack score from `1` to `99` classifying the SQL injection (SQLi) attack vector.
446446

447447
## `cf.waf.score.xss`
448448

449449
`cf.waf.score.xss` <Type text='Number' />
450450

451-
An attack score from 1 to 99 classifying the cross-site scripting (XSS) attack vector.
451+
An attack score from `1` to `99` classifying the cross-site scripting (XSS) attack vector.
452452

453453
## `cf.waf.score.rce`
454454

455455
`cf.waf.score.rce` <Type text='Number' />
456456

457-
An attack score from 1 to 99 classifying the command injection or Remote Code Execution (RCE) attack vector.
457+
An attack score from `1` to `99` classifying the command injection or Remote Code Execution (RCE) attack vector.
458458

459459
## `cf.waf.score.class`
460460

src/content/docs/waf/detections/attack-score.mdx

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,24 @@ This feature is available to Enterprise customers. Business plans have access to
2222

2323
## Available scores
2424

25-
The Cloudflare WAF provides the following attack scores:
25+
The Cloudflare WAF provides the following attack score fields:
2626

27-
| Score | Minimum plan required | Attack vector | Field |
28-
| ---------------------- | --------------------- | --------------------------- | --------------------------------------------------------------------------------------------- |
29-
| WAF Attack Score | Enterprise | N/A (global score) | [`cf.waf.score`](/ruleset-engine/rules-language/fields/dynamic-fields/#cfwafscore) |
30-
| WAF SQLi Attack Score | Enterprise | SQL injection (SQLi) | [`cf.waf.score.sqli`](/ruleset-engine/rules-language/fields/dynamic-fields/#cfwafscoresqli) |
31-
| WAF XSS Attack Score | Enterprise | Cross-site scripting (XSS) | [`cf.waf.score.xss`](/ruleset-engine/rules-language/fields/dynamic-fields/#cfwafscorexss) |
32-
| WAF RCE Attack Score | Enterprise | Remote Code Execution (RCE) | [`cf.waf.score.rce`](/ruleset-engine/rules-language/fields/dynamic-fields/#cfwafscorerce) |
33-
| WAF Attack Score Class | Business | N/A (global classification) | [`cf.waf.score.class`](/ruleset-engine/rules-language/fields/dynamic-fields/#cfwafscoreclass) |
27+
| Score | Data type | Minimum plan required | Attack vector | Field |
28+
| ---------------------- | --------- | --------------------- | --------------------------- | --------------------------------------------------------------------------------------------- |
29+
| WAF Attack Score | Number | Enterprise | N/A (global score) | [`cf.waf.score`](/ruleset-engine/rules-language/fields/dynamic-fields/#cfwafscore) |
30+
| WAF SQLi Attack Score | Number | Enterprise | SQL injection (SQLi) | [`cf.waf.score.sqli`](/ruleset-engine/rules-language/fields/dynamic-fields/#cfwafscoresqli) |
31+
| WAF XSS Attack Score | Number | Enterprise | Cross-site scripting (XSS) | [`cf.waf.score.xss`](/ruleset-engine/rules-language/fields/dynamic-fields/#cfwafscorexss) |
32+
| WAF RCE Attack Score | Number | Enterprise | Remote Code Execution (RCE) | [`cf.waf.score.rce`](/ruleset-engine/rules-language/fields/dynamic-fields/#cfwafscorerce) |
33+
| WAF Attack Score Class | String | Business | N/A (global classification) | [`cf.waf.score.class`](/ruleset-engine/rules-language/fields/dynamic-fields/#cfwafscoreclass) |
3434

35-
You can use these fields in expressions of [custom rules](/waf/custom-rules/) and [rate limiting rules](/waf/rate-limiting-rules/) where:
35+
You can use these fields in expressions of [custom rules](/waf/custom-rules/) and [rate limiting rules](/waf/rate-limiting-rules/). Attack score fields of data type `Number` vary between `1` and `99` with the following meaning:
3636

3737
- A score of `1` indicates that the request is almost certainly malicious.
3838
- A score of `99` indicates that the request is likely clean.
39-
- A score of `100` indicates that the Cloudflare WAF did not score the request.
4039

41-
The available scores are independent of each other. Namely, the WAF Attack Score is not a sum of the other scores.
40+
The special score `100` indicates that the Cloudflare WAF did not score the request.
41+
42+
The global WAF Attack Score is mathematically derived from individual attack scores (for example, from SQLi Attack Score and XSS Attack Score), reflecting their interdependence. However, the global score is not a sum of individual scores. A low global score usually indicates medium to low individual scores, while a high global score suggests higher individual scores.
4243

4344
The WAF Attack Score Class field can have one of the following values, depending on the calculated request attack score:
4445

@@ -49,23 +50,41 @@ The WAF Attack Score Class field can have one of the following values, depending
4950
| _Likely clean_ | `likely_clean` | Attack score between `51` and `80`. |
5051
| _Clean_ | `clean` | Attack score between `81` and `99`. |
5152

52-
Requests with an attack score of `100` will have a class of _Unscored_ in the Cloudflare dashboard, but you cannot use this class value in rule expressions.
53+
Requests with the special attack score `100` will show a WAF Attack Score Class of _Unscored_ in the Cloudflare dashboard, but you cannot use this class value in rule expressions.
5354

5455
Attack score automatically detects and decodes Base64, JavaScript (Unicode escape sequences), and URL encoded content anywhere in the request: URL, headers, and body.
5556

57+
## Rule recommendations
58+
59+
Cloudflare does not recommend that you block traffic solely based on the WAF Attack Score for all values below `50`, since the _Likely attack_ range (scores between `21` and `50`) tends to have false positives. If you want to block traffic based on this score, do one of the following:
60+
61+
- Use a more strict WAF Attack Score value in your expression. For example, block traffic with a WAF attack score below `20` or below `15` (you may need to adjust the exact threshold).
62+
63+
- Combine a higher WAF Attack Score threshold with additional filters when blocking incoming traffic. For example, include a check for a specific URI path in your expression or use bot score as part of your criteria.
64+
5665
---
5766

5867
## Start using WAF attack score
5968

6069
### 1. Create a custom rule
6170

62-
If you are an Enterprise customer:
71+
If you are an Enterprise customer, create a [WAF custom rule](/waf/custom-rules/create-dashboard/) that blocks requests with a **WAF Attack Score** less than or equal to 20 (recommended initial threshold). For example:
72+
73+
| Field | Operator | Value |
74+
| ---------------- | --------------------- | ----- |
75+
| WAF Attack Score | less than or equal to | `20` |
76+
77+
- Equivalent rule expression: `cf.waf.score le 20`
78+
- Action: _Block_
6379

64-
- Create a [WAF custom rule](/waf/custom-rules/create-dashboard/) that logs all requests with a WAF Attack Score below 40 (recommended initial threshold). For example, set the rule expression to `cf.waf.score lt 40` and the rule action to _Log_.
80+
Business customers must create a custom rule with the **WAF Attack Score Class** field instead. For example, use this field to block incoming requests with a score class of _Attack_:
6581

66-
If you are a Business customer:
82+
| Field | Operator | Value |
83+
| ---------------------- | -------- | -------- |
84+
| WAF Attack Score Class | equals | `Attack` |
6785

68-
- Create a [WAF custom rule](/waf/custom-rules/create-dashboard/) matching requests with a WAF Attack Score Class of _Attack_. For example, set the rule expression to `cf.waf.score.class eq "attack"` and the rule action to a challenge action (such as _Managed Challenge_) or _Block_.
86+
- Equivalent rule expression: `cf.waf.score.class eq "attack"`
87+
- Action: _Block_
6988

7089
### 2. Monitor domain traffic
7190

0 commit comments

Comments
 (0)