Hidden Directory Creation via Unusual Parent

This rule detects the creation of a hidden directory via an unusual parent executable. Hidden directories are directories that are not visible to the user by default. They are often used by attackers to hide malicious files or tools.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2024/11/01"
  3integration = ["endpoint"]
  4maturity = "production"
  5updated_date = "2024/11/01"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10This rule detects the creation of a hidden directory via an unusual parent executable. Hidden directories are
 11directories that are not visible to the user by default. They are often used by attackers to hide malicious files or
 12tools.
 13"""
 14false_positives = [
 15    """
 16    Certain tools may create hidden temporary directories upon installation or as part of their normal
 17    behavior. These events can be filtered by the process arguments, username, or process name values.
 18    """,
 19]
 20from = "now-9m"
 21index = ["logs-endpoint.events.*"]
 22language = "eql"
 23license = "Elastic License v2"
 24name = "Hidden Directory Creation via Unusual Parent"
 25risk_score = 21
 26rule_id = "b15a15f2-becf-475d-aa69-45c9e0ff1c49"
 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: Defense Evasion",
 58    "Data Source: Elastic Defend",
 59    "Tactic: Persistence",
 60]
 61timestamp_override = "event.ingested"
 62type = "eql"
 63query = '''
 64process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
 65process.name == "mkdir" and process.parent.executable like (
 66  "/dev/shm/*", "/tmp/*", "/var/tmp/*", "/var/run/*", "/root/*", "/boot/*", "/var/www/html/*", "/opt/.*"
 67) and process.args like (".*", "/*/.*") and process.args_count <= 3 and not (
 68  process.parent.executable like ("/tmp/newroot/*", "/run/containerd/*") or
 69  process.command_line like ("mkdir -p .", "mkdir ./*") or
 70  process.parent.executable like (
 71    "/tmp/pear/temp/*", "/var/tmp/buildah*", "/tmp/python-build.*", "/tmp/cliphist-wofi-img"
 72  )
 73)
 74'''
 75
 76[[rule.threat]]
 77framework = "MITRE ATT&CK"
 78
 79[[rule.threat.technique]]
 80id = "T1564"
 81name = "Hide Artifacts"
 82reference = "https://attack.mitre.org/techniques/T1564/"
 83
 84[[rule.threat.technique.subtechnique]]
 85id = "T1564.001"
 86name = "Hidden Files and Directories"
 87reference = "https://attack.mitre.org/techniques/T1564/001/"
 88
 89[rule.threat.tactic]
 90id = "TA0005"
 91name = "Defense Evasion"
 92reference = "https://attack.mitre.org/tactics/TA0005/"
 93
 94[[rule.threat]]
 95framework = "MITRE ATT&CK"
 96
 97[rule.threat.tactic]
 98id = "TA0003"
 99name = "Persistence"
100reference = "https://attack.mitre.org/tactics/TA0003/"

Related rules

to-top