Potential Privilege Escalation via UID INT_MAX Bug Detected

This rule monitors for the execution of the systemd-run command by a user with a UID that is larger than the maximum allowed UID size (INT_MAX). Some older Linux versions were affected by a bug which allows user accounts with a UID greater than INT_MAX to escalate privileges by spawning a shell through systemd-run.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2023/07/27"
 3integration = ["endpoint"]
 4maturity = "production"
 5updated_date = "2024/05/21"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10This rule monitors for the execution of the systemd-run command by a user with a UID that is larger than the maximum
11allowed UID size (INT_MAX). Some older Linux versions were affected by a bug which allows user accounts with a UID
12greater than INT_MAX to escalate privileges by spawning a shell through systemd-run.
13"""
14from = "now-9m"
15index = ["logs-endpoint.events.*", "endgame-*"]
16language = "eql"
17license = "Elastic License v2"
18name = "Potential Privilege Escalation via UID INT_MAX Bug Detected"
19references = [
20    "https://twitter.com/paragonsec/status/1071152249529884674",
21    "https://github.com/mirchr/security-research/blob/master/vulnerabilities/CVE-2018-19788.sh",
22    "https://gitlab.freedesktop.org/polkit/polkit/-/issues/74",
23]
24risk_score = 47
25rule_id = "d55436a8-719c-445f-92c4-c113ff2f9ba5"
26setup = """## Setup
27
28This rule requires data coming in from Elastic Defend.
29
30### Elastic Defend Integration Setup
31Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
32
33#### Prerequisite Requirements:
34- Fleet is required for Elastic Defend.
35- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
36
37#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
38- Go to the Kibana home page and click "Add integrations".
39- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
40- Click "Add Elastic Defend".
41- Configure the integration name and optionally add a description.
42- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
43- 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).
44- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
45- 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.
46For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
47- Click "Save and Continue".
48- 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.
49For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
50"""
51severity = "medium"
52tags = [
53    "Domain: Endpoint",
54    "OS: Linux",
55    "Use Case: Threat Detection",
56    "Tactic: Privilege Escalation",
57    "Data Source: Elastic Defend",
58    "Data Source: Elastic Endgame",
59]
60timestamp_override = "event.ingested"
61type = "eql"
62
63query = '''
64process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event") and 
65process.name == "systemd-run" and process.args == "-t" and process.args_count >= 3 and user.id >= "1000000000"
66'''
67
68
69[[rule.threat]]
70framework = "MITRE ATT&CK"
71[[rule.threat.technique]]
72id = "T1068"
73name = "Exploitation for Privilege Escalation"
74reference = "https://attack.mitre.org/techniques/T1068/"
75
76
77[rule.threat.tactic]
78id = "TA0004"
79name = "Privilege Escalation"
80reference = "https://attack.mitre.org/tactics/TA0004/"

References

Related rules

to-top