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/09/23"
  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"
 21references = ["https://www.elastic.co/security-labs/primer-on-persistence-mechanisms"]
 22risk_score = 21
 23rule_id = "5b06a27f-ad72-4499-91db-0c69667bffa5"
 24setup = """## Setup
 25
 26This rule requires data coming in from Elastic Defend.
 27
 28### Elastic Defend Integration Setup
 29Elastic 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.
 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 selecting "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 = "low"
 50tags = [
 51    "Domain: Endpoint",
 52    "OS: Linux",
 53    "Use Case: Threat Detection",
 54    "Tactic: Discovery",
 55    "Tactic: Privilege Escalation",
 56    "Data Source: Elastic Defend",
 57]
 58timestamp_override = "event.ingested"
 59type = "eql"
 60
 61query = '''
 62process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and 
 63process.name == "find" and process.args : "-perm" and process.args : (
 64  "/6000", "-6000", "/4000", "-4000", "/2000", "-2000", "/u=s", "-u=s", "/g=s", "-g=s", "/u=s,g=s", "/g=s,u=s"
 65) and not (
 66  user.Ext.real.id == "0" or group.Ext.real.id == "0" or process.args_count >= 12 or 
 67  (process.args : "/usr/bin/pkexec" and process.args : "-xdev" and process.args_count == 7)
 68)
 69'''
 70
 71
 72[[rule.threat]]
 73framework = "MITRE ATT&CK"
 74[[rule.threat.technique]]
 75id = "T1083"
 76name = "File and Directory Discovery"
 77reference = "https://attack.mitre.org/techniques/T1083/"
 78
 79
 80[rule.threat.tactic]
 81id = "TA0007"
 82name = "Discovery"
 83reference = "https://attack.mitre.org/tactics/TA0007/"
 84[[rule.threat]]
 85framework = "MITRE ATT&CK"
 86[[rule.threat.technique]]
 87id = "T1548"
 88name = "Abuse Elevation Control Mechanism"
 89reference = "https://attack.mitre.org/techniques/T1548/"
 90[[rule.threat.technique.subtechnique]]
 91id = "T1548.001"
 92name = "Setuid and Setgid"
 93reference = "https://attack.mitre.org/techniques/T1548/001/"
 94
 95
 96
 97[rule.threat.tactic]
 98id = "TA0004"
 99name = "Privilege Escalation"
100reference = "https://attack.mitre.org/tactics/TA0004/"
101[[rule.threat]]
102framework = "MITRE ATT&CK"
103
104[rule.threat.tactic]
105id = "TA0003"
106name = "Persistence"
107reference = "https://attack.mitre.org/tactics/TA0003/"

References

Related rules

to-top