UID Elevation from Previously Unknown Executable
Monitors for the elevation of regular user permissions to root permissions through a previously unknown executable. Attackers may attempt to evade detection by hijacking the execution flow and hooking certain functions/syscalls through a rootkit in order to provide easy access to root via a special modified command.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2023/10/26"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2024/10/17"
6
7[rule]
8author = ["Elastic"]
9description = """
10Monitors for the elevation of regular user permissions to root permissions through a previously unknown executable.
11Attackers may attempt to evade detection by hijacking the execution flow and hooking certain functions/syscalls through
12a rootkit in order to provide easy access to root via a special modified command.
13"""
14from = "now-9m"
15index = ["logs-endpoint.events.*"]
16language = "kuery"
17license = "Elastic License v2"
18name = "UID Elevation from Previously Unknown Executable"
19risk_score = 47
20rule_id = "7787362c-90ff-4b1a-b313-8808b1020e64"
21setup = """## Setup
22
23This rule requires data coming in from Elastic Defend.
24
25### Elastic Defend Integration Setup
26Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows
27the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
28
29#### Prerequisite Requirements:
30- Fleet is required for Elastic Defend.
31- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
32
33#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
34- Go to the Kibana home page and click Add integrations.
35- In the query bar, search for Elastic Defend and select the integration to see more details about it.
36- Click Add Elastic Defend.
37- Configure the integration name and optionally add a description.
38- Select the type of environment you want to protect, either Traditional Endpoints or Cloud Workloads.
39- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
40- We suggest to select "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
41- Enter a name for the agent policy in New agent policy name. If other agent policies already exist, you can click the Existing hosts tab and select an existing policy instead.
42For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
43- Click Save and Continue.
44- To complete the integration, select Add Elastic Agent to your hosts and continue to the next section to install the Elastic Agent on your hosts.
45For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
46"""
47severity = "medium"
48tags = [
49 "Domain: Endpoint",
50 "OS: Linux",
51 "Use Case: Threat Detection",
52 "Tactic: Privilege Escalation",
53 "Tactic: Defense Evasion",
54 "Data Source: Elastic Defend",
55]
56timestamp_override = "event.ingested"
57type = "new_terms"
58
59query = '''
60host.os.type:"linux" and event.category:"process" and event.action:"uid_change" and event.type:"change" and user.id:"0"
61and process.parent.name:("bash" or "dash" or "sh" or "tcsh" or "csh" or "zsh" or "ksh" or "fish") and not (
62 process.executable:(
63 /bin/* or /usr/bin/* or /sbin/* or /usr/sbin/* or /snap/* or /tmp/newroot/* or /var/lib/docker/* or /usr/local/* or
64 /opt/psa/admin/* or /usr/lib/snapd/snap-confine or /opt/dynatrace/* or /opt/microsoft/* or
65 /var/lib/snapd/snap/bin/node or /opt/gitlab/embedded/sbin/logrotate or /etc/apt/universal-hooks/* or
66 /opt/puppetlabs/puppet/bin/puppet or /opt/cisco/* or /run/k3s/containerd/* or /usr/lib/postfix/sbin/master or
67 /usr/libexec/postfix/local or /var/lib/snapd/snap/bin/postgresql* or /opt/puppetlabs/puppet/bin/ruby
68 ) or
69 process.name:(
70 "bash" or "dash" or "sh" or "tcsh" or "csh" or "zsh" or "ksh" or "fish" or "sudo" or "su" or "apt" or "apt-get" or
71 "aptitude" or "squid" or "snap" or "fusermount" or "pkexec" or "umount" or "master" or "omsbaseline" or "dzdo" or
72 "sandfly" or "logrotate"
73 ) or
74 process.args:/usr/bin/python*
75)
76'''
77
78[[rule.threat]]
79framework = "MITRE ATT&CK"
80
81[[rule.threat.technique]]
82id = "T1574"
83name = "Hijack Execution Flow"
84reference = "https://attack.mitre.org/techniques/T1574/"
85
86[[rule.threat.technique.subtechnique]]
87id = "T1574.013"
88name = "KernelCallbackTable"
89reference = "https://attack.mitre.org/techniques/T1574/013/"
90
91[rule.threat.tactic]
92id = "TA0004"
93name = "Privilege Escalation"
94reference = "https://attack.mitre.org/tactics/TA0004/"
95
96[[rule.threat]]
97framework = "MITRE ATT&CK"
98
99[[rule.threat.technique]]
100id = "T1014"
101name = "Rootkit"
102reference = "https://attack.mitre.org/techniques/T1014/"
103
104[rule.threat.tactic]
105id = "TA0005"
106name = "Defense Evasion"
107reference = "https://attack.mitre.org/tactics/TA0005/"
108
109[rule.new_terms]
110field = "new_terms_fields"
111value = ["process.executable"]
112
113[[rule.new_terms.history_window_start]]
114field = "history_window_start"
115value = "now-14d"
Related rules
- Kernel Load or Unload via Kexec Detected
- Suspicious Kworker UID Elevation
- Deprecated - Potential Process Injection via LD_PRELOAD Environment Variable
- Potential Shadow File Read via Command Line Utilities
- Potential Hidden Process via Mount Hidepid