SUID/SGUID Enumeration Detected

This rule monitors for the usage of the "find" command in conjunction with SUID and SGUID permission arguments. SUID (Set User ID) and SGID (Set Group ID) are special permissions in Linux that allow a program to execute with the privileges of the file owner or group, respectively, rather than the privileges of the user running the program. In case an attacker is able to enumerate and find a binary that is misconfigured, they might be able to leverage this misconfiguration to escalate privileges by exploiting vulnerabilities or built-in features in the privileged program.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2023/07/24"
  3integration = ["endpoint"]
  4maturity = "production"
  5updated_date = "2024/05/21"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10This rule monitors for the usage of the "find" command in conjunction with SUID and SGUID permission arguments. SUID
 11(Set User ID) and SGID (Set Group ID) are special permissions in Linux that allow a program to execute with the
 12privileges of the file owner or group, respectively, rather than the privileges of the user running the program. In case
 13an attacker is able to enumerate and find a binary that is misconfigured, they might be able to leverage this
 14misconfiguration to escalate privileges by exploiting vulnerabilities or built-in features in the privileged program.
 15"""
 16from = "now-9m"
 17index = ["logs-endpoint.events.*"]
 18language = "eql"
 19license = "Elastic License v2"
 20name = "SUID/SGUID Enumeration Detected"
 21risk_score = 21
 22rule_id = "5b06a27f-ad72-4499-91db-0c69667bffa5"
 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 the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
 29
 30#### Prerequisite Requirements:
 31- Fleet is required for Elastic Defend.
 32- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
 33
 34#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
 35- Go to the Kibana home page and click "Add integrations".
 36- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
 37- Click "Add Elastic Defend".
 38- Configure the integration name and optionally add a description.
 39- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
 40- 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).
 41- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
 42- 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.
 43For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
 44- Click "Save and Continue".
 45- 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.
 46For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
 47"""
 48severity = "low"
 49tags = [
 50    "Domain: Endpoint",
 51    "OS: Linux",
 52    "Use Case: Threat Detection",
 53    "Tactic: Discovery",
 54    "Tactic: Privilege Escalation",
 55    "Data Source: Elastic Defend",
 56]
 57timestamp_override = "event.ingested"
 58type = "eql"
 59
 60query = '''
 61process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and 
 62process.name == "find" and process.args : "-perm" and process.args : (
 63  "/6000", "-6000", "/4000", "-4000", "/2000", "-2000", "/u=s", "-u=s", "/g=s", "-g=s", "/u=s,g=s", "/g=s,u=s"
 64) and not (
 65  user.Ext.real.id == "0" or group.Ext.real.id == "0" or process.args_count >= 12 or 
 66  (process.args : "/usr/bin/pkexec" and process.args : "-xdev" and process.args_count == 7)
 67)
 68'''
 69
 70
 71[[rule.threat]]
 72framework = "MITRE ATT&CK"
 73[[rule.threat.technique]]
 74id = "T1083"
 75name = "File and Directory Discovery"
 76reference = "https://attack.mitre.org/techniques/T1083/"
 77
 78
 79[rule.threat.tactic]
 80id = "TA0007"
 81name = "Discovery"
 82reference = "https://attack.mitre.org/tactics/TA0007/"
 83[[rule.threat]]
 84framework = "MITRE ATT&CK"
 85[[rule.threat.technique]]
 86id = "T1548"
 87name = "Abuse Elevation Control Mechanism"
 88reference = "https://attack.mitre.org/techniques/T1548/"
 89[[rule.threat.technique.subtechnique]]
 90id = "T1548.001"
 91name = "Setuid and Setgid"
 92reference = "https://attack.mitre.org/techniques/T1548/001/"
 93
 94
 95
 96[rule.threat.tactic]
 97id = "TA0004"
 98name = "Privilege Escalation"
 99reference = "https://attack.mitre.org/tactics/TA0004/"
100[[rule.threat]]
101framework = "MITRE ATT&CK"
102
103[rule.threat.tactic]
104id = "TA0003"
105name = "Persistence"
106reference = "https://attack.mitre.org/tactics/TA0003/"

Related rules

to-top