Detection rules › Elastic
Elevated Apple Script Execution via Unsigned Parent
Identifies execution of the Apple script interpreter (osascript) without a password prompt with administrator privileges and from unsigned or untrusted parent process.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Privilege Escalation |
Telemetry coverage
Rule body
[rule]
description = """
Identifies execution of the Apple script interpreter (osascript) without a password prompt with administrator privileges
and from unsigned or untrusted parent process.
"""
id = "f17c8dcf-d65f-479a-b047-3558233f774e"
license = "Elastic License v2"
name = "Elevated Apple Script Execution via Unsigned Parent"
os_list = ["macos"]
reference = ["https://discussions.apple.com/thread/2266150"]
version = "1.0.26"
query = '''
sequence with maxspan=1m
[process where event.action == "exec" and
(process.code_signature.trusted == false or process.code_signature.exists == false)] by process.entity_id
[process where event.action == "exec" and (process.name in ("osascript", "sh", "bash", "zsh", "dash", "csh", "tcsh", "ksh", "tclsh", "fish") or process.name like "tclsh*") and
process.command_line like~ "*osascript*with administrator privileges*"] by process.parent.entity_id
'''
min_endpoint_version = "8.1.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[internal]
min_endpoint_version = "8.1.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id, process.parent.entity_id.
Stage 1: process
[process where event.action == "exec" and
(process.code_signature.trusted == false or process.code_signature.exists == false)] by process.entity_id
Stage 2: process
[process where event.action == "exec" and (process.name in ("osascript", "sh", "bash", "zsh", "dash", "csh", "tcsh", "ksh", "tclsh", "fish") or process.name like "tclsh*") and
process.command_line like~ "*osascript*with administrator privileges*"] 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" |
process.code_signature.exists | eq |
| field:"process.code_signature.exists" kind:eq value:"false" |
process.code_signature.trusted | eq |
| field:"process.code_signature.trusted" kind:eq value:"false" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard value:"*osascript*with administrator privileges*" |
process.name | in |
| field:"process_name" kind:in |
process.name | wildcard |
| field:"process_name" kind:wildcard value:"tclsh*" |