Detection rules › Elastic
Curl Download and OsaScript Payload Execution via Node
Detects when curl or nscurl is executed as an argument of a shell interpreter via a node parent process. This is a common technique used by malware to download additional payloads and evade traditional defenses.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Command & Control |
Telemetry coverage
Rule body
[rule]
description = """
Detects when curl or nscurl is executed as an argument of a shell interpreter via a node parent process. This is a
common technique used by malware to download additional payloads and evade traditional defenses.
"""
id = "1ef77794-f718-4bc0-a846-971c45aa00e7"
license = "Elastic License v2"
name = "Curl Download and OsaScript Payload Execution via Node"
os_list = ["macos"]
reference = ["https://medium.com/@D00MFist/loads-of-fun-e1f0dac3d4f8"]
version = "1.0.11"
query = '''
sequence with maxspan=30s
[process where event.type == "start" and process.parent.name == "node" and
(
(process.name like~ ("sh", "bash", "zsh", "tclsh*") and
process.args == "-c" and
process.args like~ ("curl*", "nscurl*")) or
(process.name in ("curl", "nscurl"))
)] by process.entity_id
[process where event.type == "start" and event.action == "exec" and process.name == "osascript"] by process.parent.entity_id
'''
min_endpoint_version = "8.7.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[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.7.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 30s, correlated by process.entity_id, process.parent.entity_id.
Stage 1: process
[process where event.type == "start" and process.parent.name == "node" and
(
(process.name like~ ("sh", "bash", "zsh", "tclsh*") and
process.args == "-c" and
process.args like~ ("curl*", "nscurl*")) or
(process.name in ("curl", "nscurl"))
)] by process.entity_id
Stage 2: process
[process where event.type == "start" and event.action == "exec" and process.name == "osascript"] by process.parent.entity_id
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | eq |
| field:"process.args" kind:eq value:"-c" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | eq |
| field:"process_name" kind:eq value:"osascript" |
process.name | in |
| field:"process_name" kind:in |
process.name | wildcard |
| field:"process_name" kind:wildcard |
process.parent.name | eq |
| field:"parent_process_name" kind:eq value:"node" |