Skip to content

Commit 7afb9fc

Browse files
authored
[Page Shield] Add new ML scores (#17204)
1 parent 638c0ee commit 7afb9fc

File tree

3 files changed

+51
-21
lines changed

3 files changed

+51
-21
lines changed

src/content/changelogs/page-shield.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ productLink: "/page-shield/"
55
productArea: Application security
66
productAreaLink: /fundamentals/reference/changelog/security/
77
entries:
8+
- publish_date: "2024-09-30"
9+
title: New machine learning (ML) scores for detected scripts
10+
description: |-
11+
In addition to the global integrity score, Page Shield now provides individual script scores (from 1 to 99) for the following malicious code detections: Magecart, Crypto mining, and Malware.
12+
813
- publish_date: "2024-09-18"
914
title: Page Shield's script monitor now available in Free plan
1015
description: |-

src/content/docs/page-shield/how-it-works/malicious-script-detection.mdx

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,39 @@ sidebar:
66
head: []
77
description: Page Shield implements different mechanisms to determine if a
88
script or a connection is malicious.
9-
109
---
1110

1211
:::note
13-
14-
This feature is available as a paid add-on for customers on an Enterprise plan.
12+
This feature is available as a paid add-on for customers on an Enterprise plan.
1513
:::
1614

1715
Page Shield implements different mechanisms to determine if a script, or a connection made by a script, is malicious. These mechanisms are:
1816

19-
* Malicious URL checks
20-
* Malicious domain checks
21-
* Malicious script detection
17+
- Malicious script detection
18+
- Malicious URL checks
19+
- Malicious domain checks
2220

2321
Any updates to the threat feeds will trigger new checks for previously detected scripts or connections so that the Page Shield dashboards always reflect the latest categorization.
2422

23+
## Malicious script detection
24+
25+
In this type of detection, Page Shield will download the script file and run it through a classifier. The classifier is a machine learning (ML) model that has learned to detect patterns of malicious operations such as [Magecart-type attacks](https://sansec.io/what-is-magecart).
26+
27+
The script classifier will output a probability score for the script (also called the JS integrity score) between 1 and 99, where 1 means definitely malicious and 99 means definitely not malicious. This score, together with a threshold value, will determine if the malicious script detection system will classify the script as malicious or not.
28+
29+
The score threshold for considering a script as malicious is currently set to 10. If the script classification score is below this value, the Page Shield dashboards will display the script as being malicious.
30+
31+
In addition to the integrity score, Page Shield will also provide individual scores for different malicious code detections (scores from 1 to 99):
32+
33+
- **Magecart**
34+
- **Crypto mining**
35+
- **Malware**
36+
37+
You can configure [Malicious Script Alerts](/page-shield/reference/alerts/). You will receive an alert notification as soon as Cloudflare detects JavaScript code classified as malicious in your domain.
38+
2539
## Malicious URL checks
2640

27-
Page Shield will search for the URLs of your JavaScript dependencies in threat feeds to determine if any of those scripts should be categorized as malicious.
41+
Page Shield will search for the URLs of your JavaScript dependencies in threat intelligence feeds to determine if any of those scripts should be categorized as malicious.
2842

2943
The Page Shield dashboards display the scripts that were considered malicious at the top of the scripts list.
3044

@@ -52,19 +66,19 @@ The score threshold for considering a script as malicious is currently set to 50
5266

5367
You can configure [Malicious Script Alerts](/page-shield/reference/alerts/). You will receive an alert notification as soon as Cloudflare detects JavaScript code classified as malicious in your domain.
5468

55-
***
69+
---
5670

5771
## Malicious script and connection categories
5872

5973
Scripts and connections considered malicious are categorized based on data from threat intelligence feeds. The current categories are the following:
6074

61-
* Security threats
62-
* Command-and-Control (C2) & Botnet
63-
* Cryptomining
64-
* Spyware
65-
* Phishing
66-
* Malware
67-
* Domain Generation Algorithm (DGA) domain
68-
* Typosquatting & Impersonation
75+
- Security threats
76+
- Command-and-Control (C2) & Botnet
77+
- Crypto mining
78+
- Spyware
79+
- Phishing
80+
- Malware
81+
- Domain Generation Algorithm (DGA) domain
82+
- Typosquatting & Impersonation
6983

7084
Each script or connection considered malicious can belong to several categories.

src/content/docs/page-shield/reference/page-shield-api.mdx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ You can enable and disable Page Shield, configure its settings, and fetch inform
1212
To authenticate API requests you need an [API token](/fundamentals/api/get-started/create-token/). For more information on the required API token permissions, refer to [Roles and permissions](/page-shield/reference/roles-and-permissions/).
1313

1414
:::note
15-
1615
Refer to [API deprecations](/fundamentals/api/reference/deprecations/) for details on Page Shield API changes.
1716
:::
1817

@@ -64,9 +63,7 @@ The following table summarizes the available operations:
6463

6564
## API notes
6665

67-
- The malicious script classification (`Malicious` or `Not malicious`) is not directly available in the API. To determine this classification, compare the script's `js_integrity_score` value with the classification threshold, which is currently set to 50. Scripts with a score value lower than the threshold are considered malicious.
68-
69-
- The API provides two separate properties for malicious script/connection categories: `malicious_domain_categories` and `malicious_url_categories`, related to the `domain_reported_malicious` and `url_reported_malicious` properties, respectively. The Cloudflare dashboard displays all the categories in a single **Malicious category** field. For more information, refer to [Malicious script and connection categories](/page-shield/how-it-works/malicious-script-detection/#malicious-script-and-connection-categories).
66+
The malicious script classification (`Malicious` or `Not malicious`) is not directly available in the API. To determine this classification, compare the script's `js_integrity_score` value with the classification threshold, which is currently set to 10. Scripts with a score value lower than the threshold are considered malicious.
7067

7168
## Common API calls
7269

@@ -148,6 +145,9 @@ curl "https://api.cloudflare.com/api/v4/zones/{zone_id}/page_shield/scripts?host
148145
"js_integrity_score": 10,
149146
"obfuscation_score": 10,
150147
"dataflow_score": 8,
148+
"malware_score": 8,
149+
"cryptomining_score": 9,
150+
"magecart_score": 8,
151151
"fetched_at": "2023-05-21T16:58:07Z"
152152
}
153153
// (...)
@@ -197,6 +197,9 @@ curl "https://api.cloudflare.com/api/v4/zones/{zone_id}/page_shield/scripts?stat
197197
"js_integrity_score": 48,
198198
"obfuscation_score": 49,
199199
"dataflow_score": 45,
200+
"malware_score": 45,
201+
"cryptomining_score": 37,
202+
"magecart_score": 49,
200203
"fetched_at": "2023-05-18T03:58:07Z"
201204
}
202205
// (...)
@@ -246,6 +249,9 @@ curl "https://api.cloudflare.com/api/v4/zones/{zone_id}/page_shield/scripts/8337
246249
"js_integrity_score": 48,
247250
"obfuscation_score": 49,
248251
"dataflow_score": 45,
252+
"malware_score": 42,
253+
"cryptomining_score": 32,
254+
"magecart_score": 44,
249255
"fetched_at": "2023-05-21T16:58:07Z",
250256
"page_urls": [
251257
"http://malicious.example.com/page_two.html",
@@ -255,7 +261,12 @@ curl "https://api.cloudflare.com/api/v4/zones/{zone_id}/page_shield/scripts/8337
255261
"versions": [
256262
{
257263
"hash": "9245aad577e846dd9b990b1b32425a3fae4aad8b8a28441a8b80084b6bb75a45",
258-
"js_integrity_score": 50,
264+
"js_integrity_score": 48,
265+
"obfuscation_score": 49,
266+
"dataflow_score": 45,
267+
"malware_score": 42,
268+
"cryptomining_score": 32,
269+
"magecart_score": 44,
259270
"fetched_at": "2023-05-21T16:58:07Z"
260271
}
261272
]

0 commit comments

Comments
 (0)