Shell Command Curl Execution via Osascript


Description

Detects osascript spawning shell interpreters to execute curl commands within 15 seconds. This pattern indicates malicious AppleScript workflows used for payload downloads or C2 communication.

Query · eql

sequence by process.parent.entity_id with maxspan=15s
[process where event.type == "start" and event.action == "exec" and process.args == "-c" and process.name in ("bash", "sh", "zsh") and process.parent.name == "osascript"] 
[process where event.type == "start" and event.action == "exec" and process.name in ("curl", "nscurl")]
Raw source Shell Command Curl Execution via Osascript · Elastic TOML
Esc
Published by elastic/protections-artifacts ↗, licensed under Elastic License 2.0 ↗. Reproduced here unmodified.
[rule]
description = """
Detects osascript spawning shell interpreters to execute curl commands within 15 seconds. This pattern indicates
malicious AppleScript workflows used for payload downloads or C2 communication.
"""
id = "92840250-1d07-4e8b-9a72-d2ed03dc6bc6"
license = "Elastic License v2"
name = "Shell Command Curl Execution via Osascript"
os_list = ["macos"]
version = "1.0.3"

query = '''
sequence by process.parent.entity_id with maxspan=15s
[process where event.type == "start" and event.action == "exec" and process.args == "-c" and process.name in ("bash", "sh", "zsh") and process.parent.name == "osascript"] 
[process where event.type == "start" and event.action == "exec" and process.name in ("curl", "nscurl")]
'''

min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.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"

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.