System Binary Copied and/or Moved to Suspicious Directory

This rule monitors for the copying or moving of a system binary to a suspicious directory. Adversaries may copy/move and rename system binaries to evade detection. Copying a system binary to a different location should not occur often, so if it does, the activity should be investigated.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2023/08/29"
  3integration = ["endpoint"]
  4maturity = "production"
  5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
  6min_stack_version = "8.3.0"
  7updated_date = "2024/03/08"
  8
  9[rule]
 10author = ["Elastic"]
 11description = """
 12This rule monitors for the copying or moving of a system binary to a suspicious directory. Adversaries may copy/move 
 13and rename system binaries to evade detection. Copying a system binary to a different location should not occur often,
 14so if it does, the activity should be investigated. 
 15"""
 16from = "now-9m"
 17index = ["logs-endpoint.events.*"]
 18language = "eql"
 19license = "Elastic License v2"
 20name = "System Binary Copied and/or Moved to Suspicious Directory"
 21risk_score = 21
 22rule_id = "fda1d332-5e08-4f27-8a9b-8c802e3292a6"
 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: Defense Evasion",
 54        "Data Source: Elastic Defend"
 55        ]
 56type = "eql"
 57query = '''
 58sequence by host.id, process.entity_id with maxspan=1s
 59  [process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and 
 60   process.name in ("cp", "mv") and process.args : (
 61   // Shells
 62   "/bin/*sh", "/usr/bin/*sh", 
 63
 64   // Interpreters
 65   "/bin/python*", "/usr/bin/python*", "/bin/php*", "/usr/bin/php*", "/bin/ruby*", "/usr/bin/ruby*", "/bin/perl*",
 66   "/usr/bin/perl*", "/bin/lua*", "/usr/bin/lua*", "/bin/java*", "/usr/bin/java*", 
 67
 68   // Compilers
 69   "/bin/gcc*", "/usr/bin/gcc*", "/bin/g++*", "/usr/bin/g++*", "/bin/cc", "/usr/bin/cc",
 70
 71   // Suspicious utilities
 72   "/bin/nc", "/usr/bin/nc", "/bin/ncat", "/usr/bin/ncat", "/bin/netcat", "/usr/bin/netcat", "/bin/nc.openbsd",
 73   "/usr/bin/nc.openbsd", "/bin/*awk", "/usr/bin/*awk", "/bin/socat", "/usr/bin/socat", "/bin/openssl",
 74   "/usr/bin/openssl", "/bin/telnet", "/usr/bin/telnet", "/bin/mkfifo", "/usr/bin/mkfifo", "/bin/mknod",
 75   "/usr/bin/mknod", "/bin/ping*", "/usr/bin/ping*", "/bin/nmap", "/usr/bin/nmap",
 76
 77   // System utilities
 78   "/bin/ls", "/usr/bin/ls", "/bin/cat", "/usr/bin/cat", "/bin/sudo", "/usr/bin/sudo", "/bin/curl", "/usr/bin/curl",
 79   "/bin/wget", "/usr/bin/wget", "/bin/tmux", "/usr/bin/tmux", "/bin/screen", "/usr/bin/screen", "/bin/ssh",
 80   "/usr/bin/ssh", "/bin/ftp", "/usr/bin/ftp"
 81  ) and not process.parent.name in ("dracut-install", "apticron", "generate-from-dir", "platform-python")]
 82  [file where host.os.type == "linux" and event.action == "creation" and file.path : (
 83    "/dev/shm/*", "/run/shm/*", "/tmp/*", "/var/tmp/*", "/run/*", "/var/run/*", "/var/www/*", "/proc/*/fd/*"
 84  ) and not file.path : ("/tmp/rear*", "/var/tmp/rear*", "/var/tmp/dracut*", "/var/tmp/mkinitramfs*")]
 85'''
 86
 87[[rule.threat]]
 88framework = "MITRE ATT&CK"
 89
 90[[rule.threat.technique]]
 91id = "T1564"
 92name = "Hide Artifacts"
 93reference = "https://attack.mitre.org/techniques/T1564/"
 94
 95[[rule.threat.technique]]
 96id = "T1036"
 97name = "Masquerading"
 98reference = "https://attack.mitre.org/techniques/T1036/"
 99
100[[rule.threat.technique.subtechnique]]
101id = "T1036.003"
102name = "Rename System Utilities"
103reference = "https://attack.mitre.org/techniques/T1036/003/"
104
105[rule.threat.tactic]
106id = "TA0005"
107name = "Defense Evasion"
108reference = "https://attack.mitre.org/tactics/TA0005/"

Related rules

to-top