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 = "2023/10/26"
  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"
 69  ) or
 70  process.args:/usr/bin/python*
 71)
 72'''
 73
 74[[rule.threat]]
 75framework = "MITRE ATT&CK"
 76
 77[[rule.threat.technique]]
 78id = "T1574"
 79name = "Hijack Execution Flow"
 80reference = "https://attack.mitre.org/techniques/T1574/"
 81
 82[[rule.threat.technique.subtechnique]]
 83id = "T1574.013"
 84name = "KernelCallbackTable"
 85reference = "https://attack.mitre.org/techniques/T1574/013/"
 86
 87[rule.threat.tactic]
 88id = "TA0004"
 89name = "Privilege Escalation"
 90reference = "https://attack.mitre.org/tactics/TA0004/"
 91
 92[[rule.threat]]
 93framework = "MITRE ATT&CK"
 94
 95[rule.threat.tactic]
 96id = "TA0005"
 97name = "Defense Evasion"
 98reference = "https://attack.mitre.org/tactics/TA0005/"
 99
100[[rule.threat.technique]]
101name = "Rootkit"
102id = "T1014"
103reference = "https://attack.mitre.org/techniques/T1014/"
104
105[rule.new_terms]
106field = "new_terms_fields"
107value = ["host.id", "process.executable", "process.command_line"]
108
109[[rule.new_terms.history_window_start]]
110field = "history_window_start"
111value = "now-14d"

Related rules

to-top