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"
  5min_stack_comments = "Multiple field support in the New Terms rule type was added in Elastic 8.6"
  6min_stack_version = "8.6.0"
  7updated_date = "2024/02/21"
  8
  9[rule]
 10author = ["Elastic"]
 11description = """
 12Monitors for the elevation of regular user permissions to root permissions through a previously unknown executable.
 13Attackers may attempt to evade detection by hijacking the execution flow and hooking certain functions/syscalls through
 14a rootkit in order to provide easy access to root via a special modified command.
 15"""
 16from = "now-9m"
 17index = ["logs-endpoint.events.*"]
 18language = "kuery"
 19license = "Elastic License v2"
 20name = "UID Elevation from Previously Unknown Executable"
 21risk_score = 47
 22rule_id = "7787362c-90ff-4b1a-b313-8808b1020e64"
 23setup = """## Setup
 24
 25This rule requires data coming in from Elastic Defend.
 26
 27### Elastic Defend Integration Setup
 28Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows
 29the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
 30
 31#### Prerequisite Requirements:
 32- Fleet is required for Elastic Defend.
 33- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
 34
 35#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
 36- Go to the Kibana home page and click Add integrations.
 37- In the query bar, search for Elastic Defend and select the integration to see more details about it.
 38- Click Add Elastic Defend.
 39- Configure the integration name and optionally add a description.
 40- Select the type of environment you want to protect, either Traditional Endpoints or Cloud Workloads.
 41- 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).
 42- We suggest to select "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
 43- 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.
 44For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
 45- Click Save and Continue.
 46- 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.
 47For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
 48"""
 49severity = "medium"
 50tags = [
 51        "Domain: Endpoint",
 52        "OS: Linux",
 53        "Use Case: Threat Detection",
 54        "Tactic: Privilege Escalation",
 55        "Tactic: Defense Evasion",
 56        "Data Source: Elastic Defend"
 57        ]
 58timestamp_override = "event.ingested"
 59type = "new_terms"
 60query = '''
 61host.os.type:"linux" and event.category:"process" and event.action:"uid_change" and event.type:"change" and user.id:"0"
 62and process.parent.name:("bash" or "dash" or "sh" or "tcsh" or "csh" or "zsh" or "ksh" or "fish") and not (
 63  process.executable:(
 64    /bin/* or /usr/bin/* or /sbin/* or /usr/sbin/* or /snap/* or /tmp/newroot/* or /var/lib/docker/* or /usr/local/*
 65  ) or
 66  process.name:(
 67    "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
 68    "aptitude" or "squid" or "snap" or "fusermount" or "pkexec" or "umount" or "master" or "omsbaseline" or "dzdo" or
 69    "sandfly" or "logrotate"
 70  ) or
 71  process.args:/usr/bin/python*
 72)
 73'''
 74
 75[[rule.threat]]
 76framework = "MITRE ATT&CK"
 77
 78[[rule.threat.technique]]
 79id = "T1574"
 80name = "Hijack Execution Flow"
 81reference = "https://attack.mitre.org/techniques/T1574/"
 82
 83[[rule.threat.technique.subtechnique]]
 84id = "T1574.013"
 85name = "KernelCallbackTable"
 86reference = "https://attack.mitre.org/techniques/T1574/013/"
 87
 88[rule.threat.tactic]
 89id = "TA0004"
 90name = "Privilege Escalation"
 91reference = "https://attack.mitre.org/tactics/TA0004/"
 92
 93[[rule.threat]]
 94framework = "MITRE ATT&CK"
 95
 96[rule.threat.tactic]
 97id = "TA0005"
 98name = "Defense Evasion"
 99reference = "https://attack.mitre.org/tactics/TA0005/"
100
101[[rule.threat.technique]]
102name = "Rootkit"
103id = "T1014"
104reference = "https://attack.mitre.org/techniques/T1014/"
105
106[rule.new_terms]
107field = "new_terms_fields"
108value = ["host.id", "process.executable", "process.command_line"]
109
110[[rule.new_terms.history_window_start]]
111field = "history_window_start"
112value = "now-14d"

Related rules

to-top