File Downloaded by Curl/Wget and Piped to Interpreter

This rule detects when a file is downloaded by curl or wget, and piped to an interpreter. Attackers may use this technique to download and execute payloads for various malicious purposes, such as establishing persistence or exfiltrating data.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2026/08/19"
  3integration = ["endpoint"]
  4maturity = "production"
  5updated_date = "2026/08/19"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10This rule detects when a file is downloaded by curl or wget, and piped to an interpreter. Attackers may use this
 11technique to download and execute payloads for various malicious purposes, such as establishing persistence or
 12exfiltrating data.
 13"""
 14from = "now-9m"
 15index = ["logs-endpoint.events.process*"]
 16language = "eql"
 17license = "Elastic License v2"
 18name = "File Downloaded by Curl/Wget and Piped to Interpreter"
 19risk_score = 47
 20rule_id = "3ebdc01e-7788-4845-8e7a-c8a671ad46ea"
 21setup = """## Setup
 22
 23This rule requires data coming in from Elastic Defend.
 24
 25### Elastic Defend Integration Setup
 26Elastic 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.
 27
 28#### Prerequisite Requirements:
 29- Fleet is required for Elastic Defend.
 30- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
 31
 32#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
 33- Go to the Kibana home page and click "Add integrations".
 34- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
 35- Click "Add Elastic Defend".
 36- Configure the integration name and optionally add a description.
 37- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
 38- 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).
 39- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
 40- 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.
 41For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
 42- Click "Save and Continue".
 43- 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.
 44For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
 45"""
 46severity = "medium"
 47tags = [
 48    "Domain: Endpoint",
 49    "OS: Linux",
 50    "Use Case: Threat Detection",
 51    "Tactic: Execution",
 52    "Tactic: Command and Control",
 53    "Tactic: Defense Evasion",
 54    "Data Source: Elastic Defend"
 55]
 56type = "eql"
 57query = '''
 58sequence by host.id, process.parent.entity_id, process.working_directory with maxspan=1s
 59  [process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and process.name in ("curl", "wget") and
 60  (
 61    /* IP address and path */
 62    process.command_line regex ".*[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(:[0-9]{1,5})?\\/[^ ]+.*" or
 63    /* URL and path */
 64    process.command_line regex ".*[A-Za-z0-9][A-Za-z0-9\\-]*(\\.[A-Za-z0-9][A-Za-z0-9\\-]*)+(:[0-9]{1,5})?\\/[^ ]+.*"
 65  ) and
 66  process.args_count <= 3 and (
 67    process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "busybox", "node", "deno", "ash", "mksh", "pwsh") or
 68    process.parent.name like (".*", "python*", "perl*", "ruby*", "lua*", "php*") or
 69    process.parent.executable like (
 70      "/tmp/*", "/var/tmp/*", "/dev/shm/*", "./*", "/run/*", "/var/run/*", "/boot/*", "/sys/*", "/lost+found/*",
 71      "/proc/*", "/var/mail/*", "/var/www/*", "/dev/fd/*", "?memfd:*", "memfd:*"
 72    )
 73  ) and
 74  not (
 75    process.args in ("-h", "--help", "-V", "--version", "--output", "-O") or
 76    process.args like ("--output*", "-o*", "--remote-name*") or
 77    process.command_line like ("*127.0.0.1*", "*localhost*", "*artifacts.elastic.co*", "*ela.st*", "*elastic.co*")
 78  )]
 79  [process where host.os.type == "linux" and event.type == "end" and event.action == "end" and
 80   process.name like (
 81     "bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish",
 82     "python*", "perl*", "ruby*", "lua*", "php*", "node"
 83   ) and process.args_count == 1 and
 84   process.args like (
 85    "-bash", "-dash", "-sh", "-tcsh", "-csh", "-zsh", "-ksh", "-fish", "-ash", "-mksh", "-pwsh",
 86    "bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "ash", "mksh", "pwsh",
 87    "/bin/bash", "/bin/dash", "/bin/sh", "/bin/tcsh",
 88    "/bin/zsh", "/bin/ksh", "/bin/fish",
 89    "/bin/csh", "/bin/ash", "/bin/mksh", "/bin/pwsh",
 90    "/usr/bin/bash", "/usr/bin/dash", "/usr/bin/sh", "/usr/bin/tcsh",
 91    "/usr/bin/csh", "/usr/bin/zsh", "/usr/bin/ksh", "/usr/bin/fish",
 92    "/usr/bin/ash", "/usr/bin/mksh", "/usr/bin/pwsh",
 93    "/usr/local/bin/bash", "/usr/local/bin/dash", "/usr/local/bin/sh", "/usr/local/bin/tcsh",
 94    "/usr/local/bin/csh", "/usr/local/bin/zsh", "/usr/local/bin/ksh", "/usr/local/bin/fish",
 95    "/usr/local/bin/ash", "/usr/local/bin/mksh", "/usr/local/bin/pwsh",
 96    "python*", "/bin/python*", "/usr/bin/python*", "/usr/local/bin/python*",
 97    "perl*", "/bin/perl*", "/usr/bin/perl*", "/usr/local/bin/perl*",
 98    "ruby*", "/bin/ruby*", "/usr/bin/ruby*", "/usr/local/bin/ruby*",
 99    "lua*", "/bin/lua*", "/usr/bin/lua*", "/usr/local/bin/lua*",
100    "php*", "/bin/php*", "/usr/bin/php*", "/usr/local/bin/php*",
101    "node", "/bin/node", "/usr/bin/node", "/usr/local/bin/node",
102    "/dev/fd/*", "?memfd:*", "memfd:*"
103  )
104  ]
105'''
106
107[[rule.threat]]
108framework = "MITRE ATT&CK"
109
110[rule.threat.tactic]
111name = "Execution"
112id = "TA0002"
113reference = "https://attack.mitre.org/tactics/TA0002/"
114
115[[rule.threat.technique]]
116id = "T1059"
117name = "Command and Scripting Interpreter"
118reference = "https://attack.mitre.org/techniques/T1059/"
119
120[[rule.threat.technique.subtechnique]]
121id = "T1059.004"
122name = "Unix Shell"
123reference = "https://attack.mitre.org/techniques/T1059/004/"
124
125[[rule.threat]]
126framework = "MITRE ATT&CK"
127
128[rule.threat.tactic]
129name = "Command and Control"
130id = "TA0011"
131reference = "https://attack.mitre.org/tactics/TA0011/"
132
133[[rule.threat.technique]]
134name = "Application Layer Protocol"
135id = "T1071"
136reference = "https://attack.mitre.org/techniques/T1071/"
137
138[[rule.threat]]
139framework = "MITRE ATT&CK"
140
141[rule.threat.tactic]
142name = "Defense Evasion"
143id = "TA0005"
144reference = "https://attack.mitre.org/tactics/TA0005/"

Related rules

to-top