Detection rules › Elastic
Untrusted or Unsigned binary Execution via Osascript
Detects when Osascript is used to execute an unsigned or untrusted binary. This is highly un-common and has been observed in several malware campaigns in order to execute second-stage payloads.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution |
Telemetry coverage
Rule body
[rule]
description = """
Detects when Osascript is used to execute an unsigned or untrusted binary. This is highly un-common and has been
observed in several malware campaigns in order to execute second-stage payloads.
"""
id = "8d320f09-1887-4390-905b-6cad0df36653"
license = "Elastic License v2"
name = "Untrusted or Unsigned binary Execution via Osascript"
os_list = ["macos"]
reference = ["https://x.com/malwrhunterteam/status/1844466094159053019"]
version = "1.0.5"
query = '''
process where event.type == "start" and event.action == "exec" and process.parent.name == "osascript" and
(process.code_signature.trusted == false or process.code_signature.exists == false) and
not process.executable like "/opt/homebrew/*" and
not process.Ext.effective_parent.executable like "/Applications/Alfred 5.app/Contents/MacOS/Alfred"
'''
min_endpoint_version = "8.11.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 = "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/"
[internal]
min_endpoint_version = "8.11.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and process.parent.name == "osascript" and
(process.code_signature.trusted == false or process.code_signature.exists == false) and
not process.executable like "/opt/homebrew/*" and
not process.Ext.effective_parent.executable like "/Applications/Alfred 5.app/Contents/MacOS/Alfred"
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.Ext.effective_parent.executable | eq | /Applications/Alfred 5.app/Contents/MacOS/Alfred | excludes:process.Ext.effective_parent.executable field:"process.Ext.effective_parent.executable" value:"/Applications/Alfred 5.app/Contents/MacOS/Alfred" |
process.executable | starts_with | /opt/homebrew/ | excludes:process.executable field:"process.executable" value:"/opt/homebrew/" |
Indicators
These rows show field, operator, and value matches.