Skip to content

Commit bc3e12d

Browse files
authored
[Rule Tuning] Adapt Rules to work with Sysmon (#4480)
* [Rule Tuning] Remove Sysmon from rules that would never trigger based on its events * bump updated_date * Update rules/windows/lateral_movement_incoming_wmi.toml * Update Logic to support sysmon data * Update command_and_control_tool_transfer_via_curl.toml
1 parent 8e3ad57 commit bc3e12d

File tree

4 files changed

+48
-23
lines changed

4 files changed

+48
-23
lines changed

rules/windows/command_and_control_tool_transfer_via_curl.toml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2025/02/03"
33
integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
44
maturity = "production"
5-
updated_date = "2025/02/21"
5+
updated_date = "2025/02/22"
66
min_stack_version = "8.14.0"
77
min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
88

@@ -75,19 +75,35 @@ tags = [
7575
"Data Source: Elastic Defend",
7676
"Data Source: Windows Security Event Logs",
7777
"Data Source: Microsoft Defender for Endpoint",
78-
"Data Source: Sysmon",
7978
"Data Source: SentinelOne",
8079
"Data Source: Crowdstrike",
80+
"Data Source: Sysmon",
8181
"Resources: Investigation Guide",
8282
]
8383
timestamp_override = "event.ingested"
8484
type = "eql"
8585

8686
query = '''
87-
process where host.os.type == "windows" and event.type == "start" and user.id != "S-1-5-18" and
88-
process.executable : ("?:\\Windows\\System32\\curl.exe", "?:\\Windows\\SysWOW64\\curl.exe") and
89-
process.command_line : "*http*" and
90-
process.parent.name : ("cmd.exe", "powershell.exe", "rundll32.exe", "explorer.exe", "conhost.exe", "forfiles.exe", "wscript.exe", "cscript.exe", "mshta.exe", "hh.exe", "mmc.exe")
87+
process where host.os.type == "windows" and event.type == "start" and
88+
process.executable : (
89+
"?:\\Windows\\System32\\curl.exe",
90+
"?:\\Windows\\SysWOW64\\curl.exe"
91+
) and
92+
process.command_line : "*http*" and
93+
process.parent.name : (
94+
"cmd.exe", "powershell.exe",
95+
"rundll32.exe", "explorer.exe",
96+
"conhost.exe", "forfiles.exe",
97+
"wscript.exe", "cscript.exe",
98+
"mshta.exe", "hh.exe", "mmc.exe"
99+
) and
100+
not (
101+
user.id == "S-1-5-18" and
102+
/* Don't apply the user.id exclusion to Sysmon for compatibility */
103+
not event.dataset : ("windows.sysmon_operational", "windows.sysmon")
104+
) and
105+
/* Exclude System Integrity Processes for Sysmon */
106+
not ?winlog.event_data.IntegrityLevel == "System"
91107
'''
92108

93109

rules/windows/discovery_enumerating_domain_trusts_via_nltest.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2022/05/31"
33
integration = ["endpoint", "windows", "system", "m365_defender", "crowdstrike"]
44
maturity = "production"
5-
updated_date = "2025/02/21"
5+
updated_date = "2025/02/22"
66
min_stack_version = "8.14.0"
77
min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
88

@@ -81,8 +81,8 @@ tags = [
8181
"Data Source: Elastic Defend",
8282
"Data Source: Windows Security Event Logs",
8383
"Data Source: Microsoft Defender for Endpoint",
84-
"Data Source: Sysmon",
8584
"Data Source: Crowdstrike",
85+
"Data Source: Sysmon",
8686
]
8787
timestamp_override = "event.ingested"
8888
type = "eql"
@@ -94,8 +94,12 @@ process where host.os.type == "windows" and event.type == "start" and
9494
"/LSAQUERYFTI:*", "/PARENTDOMAIN",
9595
"/DOMAIN_TRUSTS", "/BDC_QUERY:*"
9696
) and
97-
not process.parent.name : "PDQInventoryScanner.exe" and
98-
not user.id in ("S-1-5-18", "S-1-5-19", "S-1-5-20")
97+
not process.parent.name : "PDQInventoryScanner.exe" and
98+
not (
99+
user.id in ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
100+
/* Don't apply the user.id exclusion to Sysmon for compatibility */
101+
not event.dataset : ("windows.sysmon_operational", "windows.sysmon")
102+
)
99103
'''
100104

101105

rules/windows/discovery_whoami_command_activity.toml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/02/18"
33
integration = ["endpoint", "system", "windows", "m365_defender"]
44
maturity = "production"
5-
updated_date = "2025/02/21"
5+
updated_date = "2025/02/22"
66
min_stack_version = "8.14.0"
77
min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
88

@@ -75,8 +75,8 @@ tags = [
7575
"Data Source: Elastic Endgame",
7676
"Data Source: Elastic Defend",
7777
"Data Source: Microsoft Defender for Endpoint",
78-
"Data Source: Windows Security Event Logs",
7978
"Data Source: Sysmon",
79+
"Data Source: Windows Security Event Logs"
8080
]
8181
timestamp_override = "event.ingested"
8282
type = "eql"
@@ -87,9 +87,15 @@ process where host.os.type == "windows" and event.type == "start" and process.na
8787
(
8888
/* scoped for whoami execution under system privileges */
8989
(
90-
user.domain : ("NT *", "* NT", "IIS APPPOOL") and
91-
user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20", "S-1-5-82-*") and
92-
not ?winlog.event_data.SubjectUserName : "*$"
90+
(
91+
user.domain : ("NT *", "* NT", "IIS APPPOOL") and
92+
user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20", "S-1-5-82-*") and
93+
not ?winlog.event_data.SubjectUserName : "*$" and
94+
95+
/* Sysmon will always populate user.id as S-1-5-18, leading to FPs */
96+
not event.dataset : ("windows.sysmon_operational", "windows.sysmon")
97+
) or
98+
(?process.Ext.token.integrity_level_name : "System" or ?winlog.event_data.IntegrityLevel : "System")
9399
) and
94100
not (
95101
process.parent.name : "cmd.exe" and

rules/windows/lateral_movement_incoming_wmi.toml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/11/15"
33
integration = ["endpoint", "windows"]
44
maturity = "production"
5-
updated_date = "2025/01/15"
5+
updated_date = "2025/02/22"
66
min_stack_version = "8.14.0"
77
min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
88

@@ -13,12 +13,7 @@ Identifies processes executed via Windows Management Instrumentation (WMI) on a
1313
adversary lateral movement, but could be noisy if administrators use WMI to remotely manage hosts.
1414
"""
1515
from = "now-9m"
16-
index = [
17-
"logs-endpoint.events.process-*",
18-
"logs-endpoint.events.network-*",
19-
"winlogbeat-*",
20-
"logs-windows.sysmon_operational-*",
21-
]
16+
index = ["logs-endpoint.events.process-*", "logs-endpoint.events.network-*", "logs-windows.sysmon_operational-*"]
2217
language = "eql"
2318
license = "Elastic License v2"
2419
name = "WMI Incoming Lateral Movement"
@@ -49,7 +44,11 @@ sequence by host.id with maxspan = 2s
4944
5045
[process where host.os.type == "windows" and event.type == "start" and process.parent.name : "WmiPrvSE.exe" and
5146
not (?process.Ext.token.integrity_level_name : "System" or ?winlog.event_data.IntegrityLevel : "System") and
52-
not user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
47+
not (
48+
user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
49+
/* Don't apply the user.id exclusion to Sysmon for compatibility */
50+
not event.dataset : ("windows.sysmon_operational", "windows.sysmon")
51+
) and
5352
not process.executable :
5453
("?:\\Program Files\\HPWBEM\\Tools\\hpsum_swdiscovery.exe",
5554
"?:\\Windows\\CCM\\Ccm32BitLauncher.exe",

0 commit comments

Comments
 (0)