Potential Privilege Escalation via SUID/SGID Proxy Execution

Detects potential privilege escalation via SUID/SGID proxy execution on Linux systems. Attackers may exploit binaries with the SUID/SGID bit set to execute commands with elevated privileges. This rule identifies instances where a process is executed with root privileges (user ID 0 or group ID 0) while the real user or group ID is non-root, indicating potential misuse of SUID/SGID binaries.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2025/10/30"
  3integration = ["endpoint"]
  4maturity = "production"
  5updated_date = "2025/10/30"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Detects potential privilege escalation via SUID/SGID proxy execution on Linux systems. Attackers may exploit binaries with the
 11SUID/SGID bit set to execute commands with elevated privileges. This rule identifies instances where a process is executed with
 12root privileges (user ID 0 or group ID 0) while the real user or group ID is non-root, indicating potential misuse of SUID/SGID
 13binaries. 
 14"""
 15from = "now-9m"
 16index = ["logs-endpoint.events.process*"]
 17language = "eql"
 18license = "Elastic License v2"
 19name = "Potential Privilege Escalation via SUID/SGID Proxy Execution"
 20references = [
 21    "https://dfir.ch/posts/today_i_learned_binfmt_misc/",
 22    "https://gtfobins.github.io/#+suid",
 23    "https://www.elastic.co/security-labs/primer-on-persistence-mechanisms",
 24]
 25risk_score = 21
 26rule_id = "341c6e18-9ef1-437e-bf18-b513f3ae2130"
 27setup = """## Setup
 28
 29This rule requires data coming in from Elastic Defend.
 30
 31### Elastic Defend Integration Setup
 32Elastic 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.
 33
 34#### Prerequisite Requirements:
 35- Fleet is required for Elastic Defend.
 36- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
 37
 38#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
 39- Go to the Kibana home page and click "Add integrations".
 40- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
 41- Click "Add Elastic Defend".
 42- Configure the integration name and optionally add a description.
 43- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
 44- 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).
 45- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
 46- 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.
 47For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
 48- Click "Save and Continue".
 49- 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.
 50For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
 51"""
 52severity = "low"
 53tags = [
 54    "Domain: Endpoint",
 55    "OS: Linux",
 56    "Use Case: Threat Detection",
 57    "Tactic: Privilege Escalation",
 58    "Tactic: Persistence",
 59    "Tactic: Defense Evasion",
 60    "Data Source: Elastic Defend",
 61]
 62timestamp_override = "event.ingested"
 63type = "eql"
 64query = '''
 65process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and (
 66  (process.user.id == "0" and process.real_user.id != "0") or
 67  (process.group.id == "0" and process.real_group.id != "0")
 68) and process.args in (
 69  "/bin/su", "/usr/bin/su",
 70  "/usr/bin/sudo",
 71  "/bin/mount", "/usr/bin/mount",
 72  "/bin/umount", "/usr/bin/umount",
 73  "/usr/bin/fusermount3",
 74  "/bin/passwd", "/usr/bin/passwd",
 75  "/bin/chfn", "/usr/bin/chfn",
 76  "/bin/chsh", "/usr/bin/chsh",
 77  "/bin/gpasswd", "/usr/bin/gpasswd",
 78  "/bin/newgrp", "/usr/bin/newgrp",
 79  "/sbin/unix_chkpwd", "/usr/sbin/unix_chkpwd",
 80  "/usr/bin/newuidmap", "/usr/bin/newgidmap",
 81  "/usr/lib/dbus-1.0/dbus-daemon-launch-helper", "/usr/libexec/dbus-daemon-launch-helper",
 82  "/usr/lib/openssh/ssh-keysign", "/usr/libexec/openssh/ssh-keysign",
 83  "/usr/bin/pkexec", "/usr/libexec/pkexec", "/usr/lib/polkit-1/pkexec",
 84  "/usr/lib/polkit-1/polkit-agent-helper-1", "/usr/libexec/polkit-agent-helper-1",
 85  "/usr/lib/snapd/snap-confine"
 86) and process.parent.args_count == 1 
 87'''
 88
 89[[rule.threat]]
 90framework = "MITRE ATT&CK"
 91
 92[[rule.threat.technique]]
 93id = "T1068"
 94name = "Exploitation for Privilege Escalation"
 95reference = "https://attack.mitre.org/techniques/T1068/"
 96
 97[[rule.threat.technique]]
 98id = "T1548"
 99name = "Abuse Elevation Control Mechanism"
100reference = "https://attack.mitre.org/techniques/T1548/"
101
102[[rule.threat.technique.subtechnique]]
103id = "T1548.001"
104name = "Setuid and Setgid"
105reference = "https://attack.mitre.org/techniques/T1548/001/"
106
107[rule.threat.tactic]
108id = "TA0004"
109name = "Privilege Escalation"
110reference = "https://attack.mitre.org/tactics/TA0004/"
111
112[[rule.threat]]
113framework = "MITRE ATT&CK"
114
115[rule.threat.tactic]
116id = "TA0003"
117name = "Persistence"
118reference = "https://attack.mitre.org/tactics/TA0003/"
119
120[[rule.threat]]
121framework = "MITRE ATT&CK"
122
123[rule.threat.tactic]
124name = "Defense Evasion"
125id = "TA0005"
126reference = "https://attack.mitre.org/tactics/TA0005/"
127
128[[rule.threat.technique]]
129id = "T1218"
130name = "System Binary Proxy Execution"
131reference = "https://attack.mitre.org/techniques/T1218/"

References

Related rules

to-top