Skip to content

Commit 4356a36

Browse files
Samirboustradebot-elastic
authored andcommitted
[Tuning] Top Noisy Rules (#5449)
* [Tuning] Windows BruteForce Rules Tuning #1 Multiple Logon Failure from the same Source Address: converted to ES|QL and raised the threshold to 100 failed auths, alert quality should be better since it aggregates all failed auths info into one alert vs multiple EQL matches. (expected reduction more than 50%) #2 Privileged Account Brute Force - coverted to ESQL and set the threshold to 50 in a minute. this should drop noise volume by more than 50%. * ++ * Update execution_shell_evasion_linux_binary.toml * Update execution_shell_evasion_linux_binary.toml * Update defense_evasion_indirect_exec_forfiles.toml * Update lateral_movement_remote_file_copy_hidden_share.toml * Update lateral_movement_remote_file_copy_hidden_share.toml * Update persistence_service_windows_service_winlog.toml * Update credential_access_lsass_openprocess_api.toml * Update persistence_suspicious_scheduled_task_runtime.toml * Update impact_hosts_file_modified.toml * Update defense_evasion_process_termination_followed_by_deletion.toml * Update rules/windows/credential_access_lsass_openprocess_api.toml * Update rules/windows/credential_access_bruteforce_admin_account.toml Co-authored-by: Ruben Groenewoud <[email protected]> * Update rules/windows/credential_access_lsass_openprocess_api.toml Co-authored-by: Ruben Groenewoud <[email protected]> * Update rules/windows/credential_access_bruteforce_multiple_logon_failure_same_srcip.toml Co-authored-by: Ruben Groenewoud <[email protected]> * Update credential_access_lsass_openprocess_api.toml * Update impact_hosts_file_modified.toml * Update credential_access_dollar_account_relay.toml * Update credential_access_new_terms_secretsmanager_getsecretvalue.toml --------- Co-authored-by: Ruben Groenewoud <[email protected]> (cherry picked from commit 3726611)
1 parent ced1158 commit 4356a36

12 files changed

+153
-145
lines changed

rules/cross-platform/impact_hosts_file_modified.toml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/07/07"
33
integration = ["endpoint", "windows"]
44
maturity = "production"
5-
updated_date = "2025/03/20"
5+
updated_date = "2025/12/11"
66

77
[rule]
88
author = ["Elastic"]
@@ -78,23 +78,37 @@ timestamp_override = "event.ingested"
7878
type = "eql"
7979

8080
query = '''
81-
any where
81+
any where process.executable != null and
8282
8383
/* file events for creation; file change events are not captured by some of the included sources for linux and so may
8484
miss this, which is the purpose of the process + command line args logic below */
8585
(
86-
event.category == "file" and event.type in ("change", "creation") and
86+
event.category == "file" and event.type in ("change", "creation") and event.action != "rename" and
8787
file.path : ("/private/etc/hosts", "/etc/hosts", "?:\\Windows\\System32\\drivers\\etc\\hosts") and
88-
not process.name in ("dockerd", "rootlesskit", "podman", "crio")
88+
not process.name in ("dockerd", "rootlesskit", "podman", "crio") and
89+
not process.executable : ("C:\\Program Files\\Fortinet\\FortiClient\\FCDBLog.exe",
90+
"C:\\Program Files\\Seqrite\\Seqrite\\SCANNER.EXE",
91+
"C:\\Windows\\Temp\\*.ins\\inst.exe",
92+
"C:\\Windows\\System32\\svchost.exe",
93+
"C:\\Program Files\\NordVPN\\nordvpn-service.exe",
94+
"C:\\Program Files\\Tailscale\\tailscaled.exe",
95+
"C:\\Program Files\\Docker\\Docker\\com.docker.service",
96+
"C:\\Program Files\\Quick Heal\\Quick Heal AntiVirus Pro\\scanner.exe",
97+
"C:\\Program Files (x86)\\Quick Heal AntiVirus Pro\\SCANNER.EXE",
98+
"C:\\Program Files\\Quick Heal\\Quick Heal Internet Security\\scanner.exe",
99+
"C:\\Program Files (x86)\\Cisco\\Cisco AnyConnect Secure Mobility Client\\vpnagent.exe",
100+
"/opt/IBM/InformationServer/Server/DSEngine/bin/uvsh",
101+
"/usr/local/demisto/server")
89102
)
90103
or
91104
92105
/* process events for change targeting linux only */
93106
(
94107
event.category == "process" and event.type in ("start") and
95108
process.name in ("nano", "vim", "vi", "emacs", "echo", "sed") and
96-
process.args : ("/etc/hosts") and
97-
not process.parent.name in ("dhclient-script", "google_set_hostname")
109+
(process.args : ("/etc/hosts") or (process.working_directory == "/etc" and process.args == "hosts")) and
110+
not process.parent.name in ("dhclient-script", "google_set_hostname") and
111+
not process.command_line == "sed -i /Added by Google/d /etc/hosts"
98112
)
99113
'''
100114

rules/integrations/aws/credential_access_new_terms_secretsmanager_getsecretvalue.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/07/06"
33
integration = ["aws"]
44
maturity = "production"
5-
updated_date = "2025/08/18"
5+
updated_date = "2025/12/12"
66

77
[rule]
88
author = ["Nick Jones", "Elastic"]
@@ -97,7 +97,7 @@ type = "new_terms"
9797
query = '''
9898
event.dataset:aws.cloudtrail and event.provider:secretsmanager.amazonaws.com and
9999
event.action: (GetSecretValue or BatchGetSecretValue) and event.outcome:success and
100-
not user_agent.name: ("Chrome" or "Firefox" or "Safari" or "Edge" or "Brave" or "Opera")
100+
not user_agent.name: ("Chrome" or "Firefox" or "Safari" or "Edge" or "Brave" or "Opera" or "Boto3")
101101
'''
102102

103103
[rule.investigation_fields]

rules/linux/execution_shell_evasion_linux_binary.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2022/05/06"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2025/02/04"
5+
updated_date = "2025/12/11"
66

77
[rule]
88
author = ["Elastic"]
@@ -139,20 +139,18 @@ timestamp_override = "event.ingested"
139139
type = "eql"
140140

141141
query = '''
142-
process where host.os.type == "linux" and event.type == "start" and
142+
process where host.os.type == "linux" and event.type == "start" and process.executable != null and
143143
(
144144
/* launching shell from capsh */
145-
(process.name == "capsh" and process.args == "--") or
145+
(process.name == "capsh" and process.args == "--" and not process.parent.executable == "/usr/bin/log4j-cve-2021-44228-hotpatch") or
146146
147147
/* launching shells from unusual parents or parent+arg combos */
148148
(process.name in ("bash", "dash", "ash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and (
149149
(process.parent.name : "*awk" and process.parent.args : "BEGIN {system(*)}") or
150-
(process.parent.name == "git" and process.parent.args : ("*PAGER*", "!*sh", "exec *sh") or
151-
process.args : ("*PAGER*", "!*sh", "exec *sh") and not process.name == "ssh" ) or
150+
(process.parent.name == "git" and process.parent.args : ("!*sh", "exec *sh") and not process.name == "ssh" ) or
152151
(process.parent.name : ("byebug", "ftp", "strace", "zip", "tar") and
153152
(
154153
process.parent.args : "BEGIN {system(*)}" or
155-
(process.parent.args : ("*PAGER*", "!*sh", "exec *sh") or process.args : ("*PAGER*", "!*sh", "exec *sh")) or
156154
(
157155
(process.parent.args : "exec=*sh" or (process.parent.args : "-I" and process.parent.args : "*sh")) or
158156
(process.args : "exec=*sh" or (process.args : "-I" and process.args : "*sh"))
@@ -182,7 +180,8 @@ process where host.os.type == "linux" and event.type == "start" and
182180
)) or
183181
(process.name == "busybox" and event.action == "exec" and process.args_count == 2 and process.args : "*sh" and not
184182
process.executable : "/var/lib/docker/overlay2/*/merged/bin/busybox" and not (process.parent.args == "init" and
185-
process.parent.args == "runc") and not process.parent.args in ("ls-remote", "push", "fetch") and not process.parent.name == "mkinitramfs") or
183+
process.parent.args == "runc") and not process.parent.args in ("ls-remote", "push", "fetch") and not process.parent.name == "mkinitramfs" and
184+
not process.parent.executable == "/bin/busybox") or
186185
(process.name == "env" and process.args_count == 2 and process.args : "*sh") or
187186
(process.parent.name in ("vi", "vim") and process.parent.args == "-c" and process.parent.args : ":!*sh") or
188187
(process.parent.name in ("c89", "c99", "gcc") and process.parent.args : "*sh,-s" and process.parent.args == "-wrapper") or

rules/windows/credential_access_bruteforce_admin_account.toml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/08/29"
33
integration = ["system", "windows"]
44
maturity = "production"
5-
updated_date = "2025/11/14"
5+
updated_date = "2025/12/11"
66

77
[transform]
88
[[transform.osquery]]
@@ -38,8 +38,7 @@ short time interval. Adversaries will often brute force login attempts across mu
3838
password, in an attempt to gain access to accounts.
3939
"""
4040
from = "now-9m"
41-
index = ["logs-system.security*", "logs-windows.forwarded*", "winlogbeat-*"]
42-
language = "eql"
41+
language = "esql"
4342
license = "Elastic License v2"
4443
name = "Privileged Account Brute Force"
4544
note = """## Triage and analysis
@@ -103,16 +102,28 @@ tags = [
103102
"Resources: Investigation Guide",
104103
"Data Source: Windows Security Event Logs",
105104
]
106-
type = "eql"
105+
type = "esql"
107106

108107
query = '''
109-
sequence by winlog.computer_name, source.ip with maxspan=10s
110-
[authentication where host.os.type == "windows" and
111-
event.action == "logon-failed" and winlog.logon.type : "Network" and
112-
source.ip != null and source.ip != "127.0.0.1" and source.ip != "::1" and user.name : "*admin*" and
113-
114-
/* noisy failure status codes often associated to authentication misconfiguration */
115-
not winlog.event_data.Status : ("0xC000015B", "0XC000005E", "0XC0000133", "0XC0000192")] with runs=5
108+
from logs-system.security*, logs-windows.forwarded*, winlogbeat-* metadata _id, _version, _index
109+
| where event.category == "authentication" and host.os.type == "windows" and event.action == "logon-failed" and
110+
winlog.logon.type == "Network" and source.ip is not null and winlog.computer_name is not null and
111+
not cidr_match(TO_IP(source.ip), "127.0.0.0/8", "::1") and
112+
to_lower(winlog.event_data.TargetUserName) like "*admin*" and
113+
/*
114+
noisy failure status codes often associated to authentication misconfiguration
115+
0xC000015B - The user has not been granted the requested logon type (also called the logon right) at this machine.
116+
0XC000005E - There are currently no logon servers available to service the logon request.
117+
0XC0000133 - Clocks between DC and other computer too far out of sync.
118+
0XC0000192 An attempt was made to logon, but the Netlogon service was not started.
119+
0xc00000dc - DC is in shutdown phase, it will normally tell current clients to use another DC for authentication.
120+
*/
121+
not winlog.event_data.Status in ("0xc000015b", "0xc000005e", "0xc0000133", "0xc0000192", "0xc00000dc")
122+
// truncate the timestamp to a 60-second window
123+
| eval Esql.time_window = date_trunc(60 seconds, @timestamp)
124+
| stats Esql.failed_auth_count = COUNT(*), Esql.target_user_name_values = VALUES(winlog.event_data.TargetUserName), Esql.user_domain_values = VALUES(user.domain), Esql.error_codes = VALUES(winlog.event_data.Status), Esql.data_stream_namespace.values = VALUES(data_stream.namespace) by winlog.computer_name, source.ip, Esql.time_window, winlog.logon.type
125+
| where Esql.failed_auth_count >= 50
126+
| KEEP winlog.computer_name, source.ip, Esql.time_window, winlog.logon.type, Esql.*
116127
'''
117128

118129

rules/windows/credential_access_bruteforce_multiple_logon_failure_same_srcip.toml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/08/29"
33
integration = ["system", "windows"]
44
maturity = "production"
5-
updated_date = "2025/11/14"
5+
updated_date = "2025/12/11"
66

77
[transform]
88
[[transform.osquery]]
@@ -38,8 +38,7 @@ Adversaries will often brute force login attempts across multiple users with a c
3838
to gain access to accounts.
3939
"""
4040
from = "now-9m"
41-
index = ["logs-system.security*", "logs-windows.forwarded*", "winlogbeat-*"]
42-
language = "eql"
41+
language = "esql"
4342
license = "Elastic License v2"
4443
name = "Multiple Logon Failure from the same Source Address"
4544
note = """## Triage and analysis
@@ -117,24 +116,29 @@ tags = [
117116
"Resources: Investigation Guide",
118117
"Data Source: Windows Security Event Logs",
119118
]
120-
type = "eql"
119+
timestamp_override = "event.ingested"
120+
type = "esql"
121121

122122
query = '''
123-
sequence by winlog.computer_name, source.ip with maxspan=10s
124-
[authentication where host.os.type == "windows" and event.action == "logon-failed" and
125-
/* event 4625 need to be logged */
126-
winlog.logon.type : "Network" and
127-
source.ip != null and source.ip != "127.0.0.1" and source.ip != "::1" and
128-
not user.name : ("ANONYMOUS LOGON", "-", "*$") and not user.domain == "NT AUTHORITY" and
129-
130-
/*
131-
noisy failure status codes often associated to authentication misconfiguration :
123+
from logs-system.security*, logs-windows.forwarded*, winlogbeat-* metadata _id, _version, _index
124+
| where event.category == "authentication" and host.os.type == "windows" and event.action == "logon-failed" and
125+
winlog.logon.type == "Network" and source.ip is not null and winlog.computer_name is not null and
126+
not cidr_match(TO_IP(source.ip), "127.0.0.0/8", "::1") and
127+
not user.name in ("ANONYMOUS LOGON", "-") and not user.name like "*$" and user.domain != "NT AUTHORITY" and
128+
/*
129+
noisy failure status codes often associated to authentication misconfiguration
132130
0xC000015B - The user has not been granted the requested logon type (also called the logon right) at this machine.
133-
0XC000005E - There are currently no logon servers available to service the logon request.
134-
0XC0000133 - Clocks between DC and other computer too far out of sync.
135-
0XC0000192 An attempt was made to logon, but the Netlogon service was not started.
136-
*/
137-
not winlog.event_data.Status : ("0xC000015B", "0XC000005E", "0XC0000133", "0XC0000192")] with runs=10
131+
0XC000005E - There are currently no logon servers available to service the logon request.
132+
0XC0000133 - Clocks between DC and other computer too far out of sync.
133+
0XC0000192 An attempt was made to logon, but the Netlogon service was not started.
134+
0xc00000dc - DC is in shutdown phase, it will normally tell current clients to use another DC for authentication.
135+
*/
136+
not winlog.event_data.Status in ("0xc000015b", "0xc000005e", "0xc0000133", "0xc0000192", "0xc00000dc")
137+
// truncate the timestamp to a 60-second window
138+
| eval Esql.time_window = date_trunc(60 seconds, @timestamp)
139+
| stats Esql.failed_auth_count = COUNT(*), Esql.target_user_name_values = VALUES(winlog.event_data.TargetUserName), Esql.user_domain_values = VALUES(user.domain), Esql.error_codes = VALUES(winlog.event_data.Status), Esql.data_stream_namespace.values = VALUES(data_stream.namespace) by winlog.computer_name, source.ip, Esql.time_window, winlog.logon.type
140+
| where Esql.failed_auth_count >= 100
141+
| KEEP winlog.computer_name, source.ip, Esql.time_window, winlog.logon.type, Esql.*
138142
'''
139143

140144

rules/windows/credential_access_dollar_account_relay.toml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2024/07/24"
33
integration = ["system", "windows"]
44
maturity = "production"
5-
updated_date = "2025/06/16"
5+
updated_date = "2025/12/11"
66

77
[rule]
88
author = ["Elastic"]
@@ -15,13 +15,13 @@ from = "now-9m"
1515
index = ["logs-system.security*", "logs-windows.forwarded*", "winlogbeat-*"]
1616
language = "eql"
1717
license = "Elastic License v2"
18-
name = "Potential Computer Account Relay Activity"
18+
name = "Potential Computer Account NTLM Relay Activity"
1919
note = """## Triage and analysis
2020
2121
> **Disclaimer**:
2222
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
2323
24-
### Investigating Potential Computer Account Relay Activity
24+
### Investigating Potential Computer Account NTLM Relay Activity
2525
2626
### Possible investigation steps
2727
@@ -58,9 +58,9 @@ references = [
5858
"https://www.thehacker.recipes/a-d/movement/mitm-and-coerced-authentications",
5959
"https://attack.mitre.org/techniques/T1187/",
6060
]
61-
risk_score = 21
61+
risk_score = 47
6262
rule_id = "263481c8-1e9b-492e-912d-d1760707f810"
63-
severity = "low"
63+
severity = "medium"
6464
tags = [
6565
"Domain: Endpoint",
6666
"OS: Windows",
@@ -77,14 +77,16 @@ type = "eql"
7777

7878
query = '''
7979
authentication where host.os.type == "windows" and event.code in ("4624", "4625") and
80-
endswith~(user.name, "$") and winlog.logon.type : "network" and
80+
winlog.logon.type == "Network" and winlog.event_data.AuthenticationPackageName == "NTLM" and
81+
endswith~(user.name, "$") and user.name != "$" and
82+
source.ip != null and source.ip != "::1" and source.ip != "127.0.0.1" and
8183
82-
/* Filter for a machine account that matches the hostname */
83-
startswith~(host.name, substring(user.name, 0, -1)) and
84+
/* Filter for a machine account that matches the hostname */
85+
startswith~(host.name, substring(user.name, 0, -1)) and
8486
85-
/* Verify if the Source IP belongs to the host */
86-
not endswith(string(source.ip), string(host.ip)) and
87-
source.ip != null and source.ip != "::1" and source.ip != "127.0.0.1"
87+
/* Verify if the Source IP belongs to the host */
88+
not endswith(string(source.ip), string(host.ip)) and
89+
not stringContains(string(host.ip), string(source.ip))
8890
'''
8991

9092

0 commit comments

Comments
 (0)