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

Related rules

to-top