Detection rules › Elastic

Elevated Apple Script Execution via Unsigned Parent

Time window
1m
Sequence by
process.entity_id, process.parent.entity_id
Source
github.com/elastic/protections-artifacts

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

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.