Detection rules › Elastic
Temporary Binary Execution via Osascript
Detects when a binary is executed from a temporary directory via osascript. Threat actors have been see leveraging applescript to automate post execution tasks, such as downloading and executing a binary from a temporary directory.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution |
Telemetry coverage
Rule body
[rule]
description = """
Detects when a binary is executed from a temporary directory via osascript. Threat actors have been see leveraging
applescript to automate post execution tasks, such as downloading and executing a binary from a temporary directory.
"""
id = "a75b6762-fc64-4c96-b3b8-48ed000d997b"
license = "Elastic License v2"
name = "Temporary Binary Execution via Osascript"
os_list = ["macos"]
reference = ["https://x.com/MsftSecIntel/status/1891410993265123662"]
version = "1.0.3"
query = '''
process where event.type == "start" and event.action == "exec" and process.executable like ("/tmp/*", "/private/tmp/*") and
process.parent.name == "osascript"
'''
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.executable like ("/tmp/*", "/private/tmp/*") and
process.parent.name == "osascript"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.parent.name | eq |
| field:"parent_process_name" kind:eq value:"osascript" |