Skip to content

Commit a409cf5

Browse files
Aegrahtradebot-elastic
authored andcommitted
[Rule Tuning] Sudoers File Modification (#4904)
* [Rule Tuning] Sudoers File Modification * [Rule Tuning] Sudoers File Modification (cherry picked from commit 0d04f98)
1 parent 3f47edd commit a409cf5

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

rules/cross-platform/privilege_escalation_sudoers_file_mod.toml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/04/13"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2025/01/15"
5+
updated_date = "2025/07/14"
66

77
[rule]
88
author = ["Elastic"]
@@ -12,7 +12,7 @@ advantage of these configurations to execute commands as other users or spawn pr
1212
"""
1313
from = "now-9m"
1414
index = ["auditbeat-*", "logs-endpoint.events.*"]
15-
language = "kuery"
15+
language = "eql"
1616
license = "Elastic License v2"
1717
name = "Sudoers File Modification"
1818
references = ["https://www.elastic.co/security-labs/primer-on-persistence-mechanisms"]
@@ -29,12 +29,13 @@ tags = [
2929
"Resources: Investigation Guide",
3030
]
3131
timestamp_override = "event.ingested"
32-
type = "new_terms"
33-
32+
type = "eql"
3433
query = '''
35-
event.category:file and event.type:change and file.path:(/etc/sudoers* or /private/etc/sudoers*) and
36-
not process.name:(dpkg or platform-python or puppet or yum or dnf) and
37-
not process.executable:(/opt/chef/embedded/bin/ruby or /opt/puppetlabs/puppet/bin/ruby or /usr/bin/dockerd)
34+
file where host.os.type in ("linux", "macos") and event.type in ("creation", "change") and
35+
file.path like ("/etc/sudoers*", "/private/etc/sudoers*") and not (
36+
process.name in ("dpkg", "platform-python", "puppet", "yum", "dnf") or
37+
process.executable in ("/opt/chef/embedded/bin/ruby", "/opt/puppetlabs/puppet/bin/ruby", "/usr/bin/dockerd")
38+
)
3839
'''
3940
note = """## Triage and analysis
4041
@@ -71,30 +72,20 @@ The sudoers file is crucial in Unix-like systems, defining user permissions for
7172
- Implement additional monitoring on the affected system and similar systems to detect any further attempts to modify the sudoers file or other privilege escalation activities.
7273
- Review and update security policies and configurations to prevent similar incidents, ensuring that only authorized processes can modify the sudoers file."""
7374

74-
7575
[[rule.threat]]
7676
framework = "MITRE ATT&CK"
77+
7778
[[rule.threat.technique]]
7879
id = "T1548"
7980
name = "Abuse Elevation Control Mechanism"
8081
reference = "https://attack.mitre.org/techniques/T1548/"
82+
8183
[[rule.threat.technique.subtechnique]]
8284
id = "T1548.003"
8385
name = "Sudo and Sudo Caching"
8486
reference = "https://attack.mitre.org/techniques/T1548/003/"
8587

86-
87-
8888
[rule.threat.tactic]
8989
id = "TA0004"
9090
name = "Privilege Escalation"
9191
reference = "https://attack.mitre.org/tactics/TA0004/"
92-
93-
[rule.new_terms]
94-
field = "new_terms_fields"
95-
value = ["host.id", "process.executable", "file.path"]
96-
[[rule.new_terms.history_window_start]]
97-
field = "history_window_start"
98-
value = "now-7d"
99-
100-

0 commit comments

Comments
 (0)