Skip to content

Commit 605b5b9

Browse files
authored
Merge pull request Azure#13138 from Azure/v-sabiraj-updatingrules
Improve URL entity mapping in Cloudflare analytic rules
2 parents 39499a4 + 1c7c3a1 commit 605b5b9

12 files changed

+80
-90
lines changed

Solutions/Cloudflare/Analytic Rules/CloudflareBadClientIp.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,15 @@ query: |
2121
let ip_reputation = dynamic(['unknown', 'badHost', 'greylist', 'securityScanner', 'scan', 'tor']);
2222
Cloudflare
2323
| where ClientIPClass in~ (ip_reputation)
24-
| extend IPCustomEntity = SrcIpAddr
25-
| extend UrlCustomEntity = ClientRequestURI
24+
| extend CompleteUrl = strcat(HttpRequestHeaderHost,ClientRequestPath)
2625
entityMappings:
2726
- entityType: IP
2827
fieldMappings:
2928
- identifier: Address
30-
columnName: IPCustomEntity
29+
columnName: SrcIpAddr
3130
- entityType: URL
3231
fieldMappings:
3332
- identifier: Url
34-
columnName: UrlCustomEntity
35-
version: 1.0.0
33+
columnName: CompleteUrl
34+
version: 1.0.1
3635
kind: Scheduled

Solutions/Cloudflare/Analytic Rules/CloudflareEmptyUA.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ relevantTechniques:
2020
query: |
2121
Cloudflare
2222
| where isempty(HttpUserAgentOriginal)
23-
| extend IPCustomEntity = SrcIpAddr
2423
entityMappings:
2524
- entityType: IP
2625
fieldMappings:
2726
- identifier: Address
28-
columnName: IPCustomEntity
29-
version: 1.0.0
27+
columnName: SrcIpAddr
28+
version: 1.0.1
3029
kind: Scheduled

Solutions/Cloudflare/Analytic Rules/CloudflareMultipleErrorsSource.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ query: |
2323
| where HttpRequestMethod =~ 'GET'
2424
| summarize err_cnt = count() by SrcIpAddr, bin(TimeGenerated, 5m)
2525
| where err_cnt > threshold
26-
| extend IPCustomEntity = SrcIpAddr
2726
entityMappings:
2827
- entityType: IP
2928
fieldMappings:
3029
- identifier: Address
31-
columnName: IPCustomEntity
32-
version: 1.0.0
30+
columnName: SrcIpAddr
31+
version: 1.0.1
3332
kind: Scheduled

Solutions/Cloudflare/Analytic Rules/CloudflareMultipleUAs.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ query: |
2323
| where isnotempty(HttpUserAgentOriginal)
2424
| summarize d_ua = dcount(HttpUserAgentOriginal) by SrcIpAddr, bin(TimeGenerated, 3m)
2525
| where d_ua > threshold
26-
| extend IPCustomEntity = SrcIpAddr
2726
entityMappings:
2827
- entityType: IP
2928
fieldMappings:
3029
- identifier: Address
31-
columnName: IPCustomEntity
32-
version: 1.0.0
30+
columnName: SrcIpAddr
31+
version: 1.0.1
3332
kind: Scheduled

Solutions/Cloudflare/Analytic Rules/CloudflareUnexpectedCountry.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,15 @@ query: |
2121
let bl_countries = dynamic(['cn', 'hk']);
2222
Cloudflare
2323
| where SrcGeoCountry in~ (bl_countries)
24-
| extend IPCustomEntity = SrcIpAddr
25-
| extend UrlCustomEntity = ClientRequestURI
24+
| extend CompleteUrl = strcat(HttpRequestHeaderHost,ClientRequestPath)
2625
entityMappings:
2726
- entityType: IP
2827
fieldMappings:
2928
- identifier: Address
30-
columnName: IPCustomEntity
29+
columnName: SrcIpAddr
3130
- entityType: URL
3231
fieldMappings:
3332
- identifier: Url
34-
columnName: UrlCustomEntity
35-
version: 1.0.0
33+
columnName: CompleteUrl
34+
version: 1.0.1
3635
kind: Scheduled

Solutions/Cloudflare/Analytic Rules/CloudflareUnexpectedPost.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ query: |
2525
| where DstBytes != 0 or SrcBytes != 0
2626
| extend fe = extract(@'.*(\.\w+)$', 1, ClientRequestURI)
2727
| where fe in~ ('.jpg', '.jpeg', '.gif', '.png', '.icon', '.ico', '.xml', '.swf', '.svg', '.ppt', '.pttx', '.doc', '.docx', '.rtf', '.pdf', '.tif', '.zip', '.mov')
28-
| extend IPCustomEntity = SrcIpAddr
2928
entityMappings:
3029
- entityType: IP
3130
fieldMappings:
3231
- identifier: Address
33-
columnName: IPCustomEntity
34-
version: 1.0.0
32+
columnName: SrcIpAddr
33+
version: 1.0.1
3534
kind: Scheduled

Solutions/Cloudflare/Analytic Rules/CloudflareUnexpectedRequest.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ query: |
2121
Cloudflare
2222
| where HttpRequestMethod =~ 'GET'
2323
| where DstBytes != 0 or SrcBytes != 0
24-
| where ClientRequestURI has_any ('/admin', '/admin.php', 'wp-admin', '.htaccess', '/etc/shadow', '/etc/passwd', '/etc/hosts', '/etc/ssh/')
25-
| extend IPCustomEntity = SrcIpAddr
24+
| where ClientRequestURI has_any ('/admin', '/admin.php', 'wp-admin', '.htaccess', '/etc/shadow', '/etc/passwd', '/etc/hosts', '/etc/ssh/')
2625
entityMappings:
2726
- entityType: IP
2827
fieldMappings:
2928
- identifier: Address
30-
columnName: IPCustomEntity
31-
version: 1.0.1
29+
columnName: SrcIpAddr
30+
version: 1.0.2
3231
kind: Scheduled

Solutions/Cloudflare/Analytic Rules/CloudflareUnexpectedUrl.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ query: |
2222
| where HttpRequestMethod =~ 'GET'
2323
| where DstBytes != 0 or SrcBytes != 0
2424
| where ClientRequestURI matches regex @'(127\.\d{1,3}\.\d{1,3}\.\d{1,3})|(10\.\d{1,3}\.\d{1,3}\.\d{1,3})|(172\.1[6-9]\.\d{1,3}\.\d{1,3})|(172\.2[0-9]\.\d{1,3}\.\d{1,3})|(172\.3[0-1]\.\d{1,3}\.\d{1,3})|(192\.168\.\d{1,3}\.\d{1,3})'
25-
| extend IPCustomEntity = SrcIpAddr
2625
entityMappings:
2726
- entityType: IP
2827
fieldMappings:
2928
- identifier: Address
30-
columnName: IPCustomEntity
31-
version: 1.0.0
29+
columnName: SrcIpAddr
30+
version: 1.0.1
3231
kind: Scheduled

Solutions/Cloudflare/Analytic Rules/CloudflareWafThreatAllowed.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,15 @@ query: |
2121
Cloudflare
2222
| where isnotempty(WAFRuleID) or isnotempty(WAFRuleMessage)
2323
| where WAFAction =~ 'Allow'
24-
| extend IPCustomEntity = SrcIpAddr
25-
| extend UrlCustomEntity = ClientRequestURI
24+
| extend CompleteUrl = strcat(HttpRequestHeaderHost,ClientRequestPath)
2625
entityMappings:
2726
- entityType: IP
2827
fieldMappings:
2928
- identifier: Address
30-
columnName: IPCustomEntity
29+
columnName: SrcIpAddr
3130
- entityType: URL
3231
fieldMappings:
3332
- identifier: Url
34-
columnName: UrlCustomEntity
35-
version: 1.0.0
33+
columnName: CompleteUrl
34+
version: 1.0.1
3635
kind: Scheduled

Solutions/Cloudflare/Analytic Rules/CloudflareXSSProbingPattern.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,16 @@ query: |
2222
Cloudflare
2323
| where HttpRequestMethod in~ ('POST', 'PUT')
2424
| extend susp_ch = countof(ClientRequestURI, '%00')
25-
| where ClientRequestURI matches regex @'(alert\()|(alert\%28)|(String\.fromCharCode\()|(expression\(alert)' or susp_ch > s_threshold
26-
| extend IPCustomEntity = SrcIpAddr
27-
| extend UrlCustomEntity = ClientRequestURI
25+
| where ClientRequestURI matches regex @'(alert\()|(alert\%28)|(String\.fromCharCode\()|(expression\(alert)' or susp_ch > s_threshold
26+
| extend CompleteUrl = strcat(HttpRequestHeaderHost,ClientRequestPath)
2827
entityMappings:
2928
- entityType: IP
3029
fieldMappings:
3130
- identifier: Address
32-
columnName: IPCustomEntity
31+
columnName: SrcIpAddr
3332
- entityType: URL
3433
fieldMappings:
3534
- identifier: Url
36-
columnName: UrlCustomEntity
37-
version: 1.0.0
35+
columnName: CompleteUrl
36+
version: 1.0.1
3837
kind: Scheduled

0 commit comments

Comments
 (0)