Detection rules › Elastic
Suspicious Executable Download via Curl
Detects when Curl is executed via Osascript or a shell interpreter and downloads an executable file to a suspicious location. Threat actors will often use Curl to download malicious executables to a temporary location on the system. The use of Curl via Osascript elevates the suspiciousness of the activity as Osascript is a scripting language that can be used to execute AppleScript commands. The combination of these two activities is indicative of a threat actor attempting to download and execute a malicious payload on the system.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Telemetry coverage
Rule body
[rule]
description = """
Detects when Curl is executed via Osascript or a shell interpreter and downloads an executable file to a suspicious
location. Threat actors will often use Curl to download malicious executables to a temporary location on the system. The
use of Curl via Osascript elevates the suspiciousness of the activity as Osascript is a scripting language that can be
used to execute AppleScript commands. The combination of these two activities is indicative of a threat actor attempting
to download and execute a malicious payload on the system.
"""
id = "845682d9-c4e9-4ae5-a303-3410a3d03824"
license = "Elastic License v2"
name = "Suspicious Executable Download via Curl"
os_list = ["macos"]
reference = ["https://x.com/MsftSecIntel/status/1891410993265123662"]
version = "1.0.6"
query = '''
sequence by process.entity_id with maxspan=30s
[process where event.type == "start" and event.action == "exec" and process.name in ("curl", "nscurl") and process.parent.name in ("osascript", "bash", "sh", "zsh")]
[file where event.action == "modification" and file.Ext.header_bytes like~ ("cffaedfe*", "cafebabe*") and file.path like ("/tmp/*", "/private/tmp/*", "/Users/Shared/*", "/Library/Caches/*", "/Library/Fonts/*") and Effective_process.name in ("curl", "nscurl")]
'''
min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.002"
name = "AppleScript"
reference = "https://attack.mitre.org/techniques/T1059/002/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"
[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[internal]
min_endpoint_version = "8.16.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 30s, correlated by process.entity_id.
Stage 1: process
[process where event.type == "start" and event.action == "exec" and process.name in ("curl", "nscurl") and process.parent.name in ("osascript", "bash", "sh", "zsh")]
Stage 2: file
[file where event.action == "modification" and file.Ext.header_bytes like~ ("cffaedfe*", "cafebabe*") and file.path like ("/tmp/*", "/private/tmp/*", "/Users/Shared/*", "/Library/Caches/*", "/Library/Fonts/*") and Effective_process.name in ("curl", "nscurl")]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Effective_process.name | in |
| field:"Effective_process.name" kind:in |
event.action | eq |
| field:"EventType" kind:eq |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
file.Ext.header_bytes | wildcard |
| field:"file.Ext.header_bytes" kind:wildcard |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard |
process.name | in |
| field:"process_name" kind:in |
process.parent.name | in |
| field:"parent_process_name" kind:in |