Detection rules › Elastic
Curl Hidden Binary Modification via Osascript
Detects osascript spawning curl followed by creation of hidden binary files with Mach-O headers within 30 seconds. This indicates malicious AppleScript workflows downloading and staging executable payloads.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Telemetry coverage
Rule body
[rule]
description = """
Detects osascript spawning curl followed by creation of hidden binary files with Mach-O headers within 30 seconds. This
indicates malicious AppleScript workflows downloading and staging executable payloads.
"""
id = "3c3aaa63-d213-486f-b157-e4b1a45d9913"
license = "Elastic License v2"
name = "Curl Hidden Binary Modification via Osascript"
os_list = ["macos"]
version = "1.0.3"
query = '''
sequence by process.entity_id with maxspan=30s
[process where event.type == "start" and event.action == "exec" and process.name == "curl" and process.parent.name == "osascript"]
[file where event.action == "modification" and file.Ext.header_bytes like~ ("cffaedfe*", "cafebabe*") and file.name like~ ".*"]
'''
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 == "curl" and process.parent.name == "osascript"]
Stage 2: file
[file where event.action == "modification" and file.Ext.header_bytes like~ ("cffaedfe*", "cafebabe*") and file.name like~ ".*"]
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.Ext.header_bytes | wildcard |
| field:"file.Ext.header_bytes" kind:wildcard |
file.name | wildcard |
| field:"file.name" kind:wildcard value:".*" |
process.name | eq |
| field:"process_name" kind:eq value:"curl" |
process.parent.name | eq |
| field:"parent_process_name" kind:eq value:"osascript" |