Skip to content

Commit ff68812

Browse files
Add KQL query for high severity malicious activity
1 parent 1fc6b4a commit ff68812

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
let TimeWindow = 90d; // How far back to look
2+
let HitThreshold = 10; // Minimum hits to alert per SourceIp + Category
3+
let MinSeverity = 1; // Set Minimum Severity
4+
let EnableCategoryFilter = true; // Filter 1: Change to true for filtering based on Categoriesofinterest defined below
5+
let EnableDescriptionFilter = false; // Filter 2: Change to true for filtering based on Descriptionsofinterest defined below
6+
let EnableActionFilter = false; // Filter 3: Change to true for filtering based on a MatchActions defined below
7+
let CategoriesOfInterest = dynamic(["Targeted Malicious Activity was Detected", "Exploit Kit Activity Detected", "Domain Observed Used for C2 Detected", "Successful Credential Theft Detected", "Malware Command and Control Activity Detected", "Executable code was detected", "A Network Trojan was detected"]); // Filter 1
8+
let DescriptionsOfInterest = dynamic(["targeted-activity", "exploit-kit", "domain-c2", "credential-theft", "command-and-control", "shellcode-detect", "trojan-activity"]); // Filter 2
9+
let MatchActions = dynamic(["Deny", "alert"]); // Filter 3
10+
AZFWIdpsSignature
11+
| where TimeGenerated >= ago(TimeWindow)
12+
| where Severity >= MinSeverity
13+
// Filter 1: Category filter (optional)
14+
| where (EnableCategoryFilter == false) or (Category has_any (CategoriesOfInterest))
15+
// Filter 2: Description filter (optional)
16+
| where (EnableDescriptionFilter == false) or (Description has_any (DescriptionsOfInterest))
17+
// Filter 3: Action filter (optional)
18+
| where (EnableActionFilter == false) or (Action in~ (MatchActions))
19+
| summarize
20+
StartTime = min(TimeGenerated),
21+
EndTime = max(TimeGenerated),
22+
TotalHits = count(),
23+
MaxSeverity = max(Severity),
24+
Actions = make_set(Action, 5),
25+
Signatures = make_set(SignatureId, 20),
26+
Description = make_set(substring(tostring(Description), 0, 120), 3)
27+
by SourceIp, ThreatCategory = Category
28+
| where TotalHits >= HitThreshold
29+
| project
30+
StartTime,
31+
EndTime,
32+
SourceIp,
33+
ThreatCategory,
34+
TotalHits,
35+
MaxSeverity,
36+
Actions,
37+
Signatures,
38+
Description
39+
| order by MaxSeverity desc, TotalHits desc

0 commit comments

Comments
 (0)