MacOS AppleScript Shell Execution and Compilation
The following analytic detects the use of macOS AppleScript utilities to execute shell commands or compile AppleScript containing shell-command logic. The analytic identifies `osascript` invocations using…
Description
The following analytic detects the use of macOS AppleScript utilities to execute shell commands or compile AppleScript containing shell-command logic. The analytic identifies `osascript` invocations using AppleScript's `do shell script` command, which executes shell commands on the host. It also identifies `osacompile` invocations referencing `do shell script`. `osacompile` compiles AppleScript into a compiled script but does not execute it directly. Adversaries may abuse these utilities to execute shell commands, stage AppleScript payloads, or prepare scripts for later execution. Matches involving `osacompile` should be interpreted as script compilation or staging rather than confirmed shell-command execution.
Detection logic
Detection requirements
- Platform
- macOS
The rule states no platform. This is derived from the ATT&CK technique it maps to.
- Log source category
- osquery_results
Known benign triggers
- Legitimate administrative scripts or automation tools using Applescript.
MITRE ATT&CK mappings
0 exclusive techniques.This is coverage no other published rule has; it is not this rule's total technique count.
References
| Reference | Cited by |
|---|---|
| attack.mitre.org/tactics/TA0002/ | 8 |
| attack.mitre.org/techniques/T1059/002/ | 5 |
| redcanary.com/threat-detection-report/techniques/applescript/ | 2 |
| www.loobins.io/binaries/osascript/ | 5 |
From the source
- At source
- Open at source
- Upstream identifier
- ceee1f2b-4b40-4721-b91e-40d1134e9dc4
- Tagged by the source as
- MacOS Post-ExploitationEndpointendpointSplunk CloudSplunk EnterpriseSplunk Enterprise Securityendpoint
Licence
- Published under
- Apache License 2.0Read the licence
- Attribution
- Required
- Obtained under
- Apache-2.0Read the origin licence
Authorship
- Written by
- Published
- Sep 6, 2026
- Version
- 1