Skip to content

Commit 2bd1d68

Browse files
committed
[Rule Tuning] Remove host.os.type Unit Test Exception
1 parent 5c1ee12 commit 2bd1d68

File tree

35 files changed

+88
-87
lines changed

35 files changed

+88
-87
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "detection_rules"
3-
version = "1.5.9"
3+
version = "1.5.10"
44
description = "Detection Rules is the home for rules used by Elastic Security. This repository is used for the development, maintenance, testing, validation, and release of rules for Elastic Security’s Detection Engine."
55
readme = "README.md"
66
requires-python = ">=3.12"

rules/windows/credential_access_bruteforce_admin_account.toml

Lines changed: 3 additions & 2 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/03/20"
5+
updated_date = "2025/11/14"
66

77
[transform]
88
[[transform.osquery]]
@@ -107,7 +107,8 @@ type = "eql"
107107

108108
query = '''
109109
sequence by winlog.computer_name, source.ip with maxspan=10s
110-
[authentication where event.action == "logon-failed" and winlog.logon.type : "Network" and
110+
[authentication where host.os.type == "windows" and
111+
event.action == "logon-failed" and winlog.logon.type : "Network" and
111112
source.ip != null and source.ip != "127.0.0.1" and source.ip != "::1" and user.name : "*admin*" and
112113
113114
/* noisy failure status codes often associated to authentication misconfiguration */

rules/windows/credential_access_bruteforce_multiple_logon_failure_followed_by_success.toml

Lines changed: 3 additions & 3 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/03/20"
5+
updated_date = "2025/11/14"
66

77
[transform]
88
[[transform.osquery]]
@@ -111,7 +111,7 @@ type = "eql"
111111

112112
query = '''
113113
sequence by winlog.computer_name, source.ip with maxspan=5s
114-
[authentication where event.action == "logon-failed" and
114+
[authentication where host.os.type == "windows" and event.action == "logon-failed" and
115115
/* event 4625 need to be logged */
116116
winlog.logon.type : "Network" and user.id != null and
117117
source.ip != null and source.ip != "127.0.0.1" and source.ip != "::1" and
@@ -120,7 +120,7 @@ sequence by winlog.computer_name, source.ip with maxspan=5s
120120
121121
/* noisy failure status codes often associated to authentication misconfiguration */
122122
not winlog.event_data.Status : ("0xC000015B", "0XC000005E", "0XC0000133", "0XC0000192")] with runs=5
123-
[authentication where event.action == "logged-in" and
123+
[authentication where host.os.type == "windows" and event.action == "logged-in" and
124124
/* event 4624 need to be logged */
125125
winlog.logon.type : "Network" and
126126
source.ip != null and source.ip != "127.0.0.1" and source.ip != "::1" and

rules/windows/credential_access_bruteforce_multiple_logon_failure_same_srcip.toml

Lines changed: 2 additions & 2 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/03/20"
5+
updated_date = "2025/11/14"
66

77
[transform]
88
[[transform.osquery]]
@@ -121,7 +121,7 @@ type = "eql"
121121

122122
query = '''
123123
sequence by winlog.computer_name, source.ip with maxspan=10s
124-
[authentication where event.action == "logon-failed" and
124+
[authentication where host.os.type == "windows" and event.action == "logon-failed" and
125125
/* event 4625 need to be logged */
126126
winlog.logon.type : "Network" and
127127
source.ip != null and source.ip != "127.0.0.1" and source.ip != "::1" and

rules/windows/credential_access_dcsync_newterm_subjectuser.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -95,11 +95,12 @@ timestamp_override = "event.ingested"
9595
type = "new_terms"
9696

9797
query = '''
98-
event.code:"4662" and winlog.event_data.Properties:(
99-
*DS-Replication-Get-Changes* or *DS-Replication-Get-Changes-All* or
100-
*DS-Replication-Get-Changes-In-Filtered-Set* or *1131f6ad-9c07-11d1-f79f-00c04fc2dcd2* or
101-
*1131f6aa-9c07-11d1-f79f-00c04fc2dcd2* or *89e95b76-444d-4c62-991a-0facbeda640c*) and
102-
not winlog.event_data.SubjectUserName:(*$ or MSOL_*)
98+
event.code:"4662" and host.os.type:"windows" and
99+
winlog.event_data.Properties:(
100+
*DS-Replication-Get-Changes* or *DS-Replication-Get-Changes-All* or
101+
*DS-Replication-Get-Changes-In-Filtered-Set* or *1131f6ad-9c07-11d1-f79f-00c04fc2dcd2* or
102+
*1131f6aa-9c07-11d1-f79f-00c04fc2dcd2* or *89e95b76-444d-4c62-991a-0facbeda640c*) and
103+
not winlog.event_data.SubjectUserName:(*$ or MSOL_*)
103104
'''
104105

105106

rules/windows/credential_access_dcsync_user_backdoor.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -92,7 +92,7 @@ timestamp_override = "event.ingested"
9292
type = "query"
9393

9494
query = '''
95-
event.code:"5136" and
95+
event.code:"5136" and host.os.type:"windows" and
9696
winlog.event_data.AttributeLDAPDisplayName:"nTSecurityDescriptor" and
9797
winlog.event_data.AttributeValue : (
9898
(

rules/windows/credential_access_kerberos_coerce.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -93,8 +93,11 @@ timestamp_override = "event.ingested"
9393
type = "query"
9494

9595
query = '''
96-
(event.code:4662 and winlog.event_data.AdditionalInfo: *UWhRC*BAAAA*MicrosoftDNS*) or
97-
(event.code:5137 and winlog.event_data.ObjectDN: *UWhRC*BAAAA*MicrosoftDNS*)
96+
host.os.type:"windows" and
97+
(
98+
(event.code:4662 and winlog.event_data.AdditionalInfo: *UWhRC*BAAAA*MicrosoftDNS*) or
99+
(event.code:5137 and winlog.event_data.ObjectDN: *UWhRC*BAAAA*MicrosoftDNS*)
100+
)
98101
'''
99102

100103

rules/windows/credential_access_ldap_attributes.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -89,7 +89,7 @@ timestamp_override = "event.ingested"
8989
type = "eql"
9090

9191
query = '''
92-
any where event.code == "4662" and
92+
any where host.os.type == "windows" and event.code == "4662" and
9393
9494
not winlog.event_data.SubjectUserSid : "S-1-5-18" and
9595

rules/windows/credential_access_machine_account_smb_relay.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -69,7 +69,7 @@ timestamp_override = "event.ingested"
6969
type = "eql"
7070

7171
query = '''
72-
file where event.code == "5145" and endswith(user.name, "$") and
72+
file where host.os.type == "windows" and event.code == "5145" and endswith(user.name, "$") and
7373
7474
/* compare computername with user.name and make sure they match */
7575
startswith~(winlog.computer_name, substring(user.name, 0, -1)) and

rules/windows/credential_access_saved_creds_vault_winlog.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -73,12 +73,12 @@ sequence by winlog.computer_name, winlog.process.pid with maxspan=1s
7373
7474
/* 2 consecutive vault reads from same pid for web creds */
7575
76-
[any where event.code : "5382" and
76+
[any where host.os.type == "windows" and event.code == "5382" and
7777
(winlog.event_data.SchemaFriendlyName : "Windows Web Password Credential" and winlog.event_data.Resource : "http*") and
7878
not winlog.event_data.SubjectLogonId : "0x3e7" and
7979
not winlog.event_data.Resource : "http://localhost/"]
8080
81-
[any where event.code : "5382" and
81+
[any where host.os.type == "windows" and event.code == "5382" and
8282
(winlog.event_data.SchemaFriendlyName : "Windows Web Password Credential" and winlog.event_data.Resource : "http*") and
8383
not winlog.event_data.SubjectLogonId : "0x3e7" and
8484
not winlog.event_data.Resource : "http://localhost/"]

0 commit comments

Comments
 (0)