Detection rules › Elastic
Hidden AppleScript Download via Curl
Detects when Curl or NsCurl download and modify a hidden AppleScript file. Threat actors have been seen downloading a hidden AppleScript file as a second stage payload in order to facilitate additional post exploitation actions on compromised systems.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Stealth | |
| Command & Control |
Telemetry coverage
Rule body
[rule]
description = """
Detects when Curl or NsCurl download and modify a hidden AppleScript file. Threat actors have been seen downloading a
hidden AppleScript file as a second stage payload in order to facilitate additional post exploitation actions on
compromised systems.
"""
id = "a6ed2e19-67e9-4999-b4a7-499b86cf5784"
license = "Elastic License v2"
name = "Hidden AppleScript Download via Curl"
os_list = ["macos"]
reference = ["https://x.com/moonlock_lab/status/1980683916571996312"]
version = "1.0.1"
query = '''
sequence with maxspan=20s
[process where event.type == "start" and event.action == "exec" and process.name in ("curl", "nscurl")] by process.parent.entity_id
[file where event.action == "modification" and file.name : ".*" and file.extension == "scpt" and process.name in ("curl", "nscurl")] by Effective_process.entity_id
'''
min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "Effective_process.entity_id"
state = 1
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1564"
name = "Hide Artifacts"
reference = "https://attack.mitre.org/techniques/T1564/"
[[threat.technique.subtechnique]]
id = "T1564.001"
name = "Hidden Files and Directories"
reference = "https://attack.mitre.org/techniques/T1564/001/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[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 20s, correlated by Effective_process.entity_id, process.parent.entity_id.
Stage 1: process
[process where event.type == "start" and event.action == "exec" and process.name in ("curl", "nscurl")] by process.parent.entity_id
Stage 2: file
[file where event.action == "modification" and file.name : ".*" and file.extension == "scpt" and process.name in ("curl", "nscurl")] by Effective_process.entity_id
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
file.extension | eq |
| field:"file.extension" kind:eq value:"scpt" |
file.name | wildcard |
| field:"file.name" kind:wildcard value:".*" |
process.name | in |
| field:"process_name" kind:in |