Sudoers File Modification

A sudoers file specifies the commands that users or groups can run and from which terminals. Adversaries can take advantage of these configurations to execute commands as other users or spawn processes with higher privileges.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2020/04/13"
 3integration = ["endpoint"]
 4maturity = "production"
 5updated_date = "2024/05/21"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10A sudoers file specifies the commands that users or groups can run and from which terminals. Adversaries can take
11advantage of these configurations to execute commands as other users or spawn processes with higher privileges.
12"""
13from = "now-9m"
14index = ["auditbeat-*", "logs-endpoint.events.*"]
15language = "kuery"
16license = "Elastic License v2"
17name = "Sudoers File Modification"
18risk_score = 47
19rule_id = "931e25a5-0f5e-4ae0-ba0d-9e94eff7e3a4"
20severity = "medium"
21tags = [
22    "Domain: Endpoint",
23    "OS: Linux",
24    "OS: macOS",
25    "Use Case: Threat Detection",
26    "Tactic: Privilege Escalation",
27    "Data Source: Elastic Defend",
28]
29timestamp_override = "event.ingested"
30type = "new_terms"
31
32query = '''
33event.category:file and event.type:change and file.path:(/etc/sudoers* or /private/etc/sudoers*) and
34not process.name:(dpkg or platform-python or puppet or yum or dnf) and 
35not process.executable:(/opt/chef/embedded/bin/ruby or /opt/puppetlabs/puppet/bin/ruby or /usr/bin/dockerd)
36'''
37
38
39[[rule.threat]]
40framework = "MITRE ATT&CK"
41[[rule.threat.technique]]
42id = "T1548"
43name = "Abuse Elevation Control Mechanism"
44reference = "https://attack.mitre.org/techniques/T1548/"
45[[rule.threat.technique.subtechnique]]
46id = "T1548.003"
47name = "Sudo and Sudo Caching"
48reference = "https://attack.mitre.org/techniques/T1548/003/"
49
50
51
52[rule.threat.tactic]
53id = "TA0004"
54name = "Privilege Escalation"
55reference = "https://attack.mitre.org/tactics/TA0004/"
56
57[rule.new_terms]
58field = "new_terms_fields"
59value = ["host.id", "process.executable", "file.path"]
60[[rule.new_terms.history_window_start]]
61field = "history_window_start"
62value = "now-7d"

Related rules

to-top