Cross-source coverage
T1059.002 / ATT&CK
Command and Scripting Interpreter: AppleScript
49 rules across 4 sources.
From MITRE ATT&CK 19.2
Adversaries may abuse AppleScript for execution. AppleScript is a macOS scripting language designed to control applications and parts of the OS via inter-application messages called AppleEvents. These AppleEvent messages can be sent independently or easily scripted with AppleScript. These events can locate open windows, send keystrokes, and interact with almost any open application locally or remotely.
Scripts can be run from the command-line via osascript /path/to/script or osascript -e "script here". Aside from the command line, scripts can be executed in numerous ways including Mail rules, Calendar.app alarms, and Automator workflows. AppleScripts can also be executed as plain text shell scripts by adding #!/usr/bin/osascript to the start of the script file.
AppleScripts do not need to call osascript to execute. However, they may be executed from within mach-O binaries by using the macOS Native APIs NSAppleScript or OSAScript, both of which execute code independent of the /usr/bin/osascript command line utility.
Adversaries may abuse AppleScript to execute various behaviors, such as interacting with an open SSH connection, moving to remote machines, and even presenting users with fake dialog boxes. These events cannot start applications remotely (they can start them locally), but they can interact with applications if they're already running remotely. On macOS 10.10 Yosemite and higher, AppleScript has the ability to execute Native APIs, which otherwise would require compilation and execution in a mach-O binary file format. Since this is a scripting language, it can be used to launch more common techniques as well such as a reverse shell via Python.
- Tactics
- Execution
- Platforms
- macOS
- Telemetry
-
macos:unifiedlog
How MITRE says to detect it DET0414
Detection of AppleScript-Based Execution on macOS
macOS Analytic 1164
Detects AppleScript execution via 'osascript', NSAppleScript/OSAScript APIs, and abnormal application control events across user sessions. Focuses on causal chains such as osascript spawning child processes, script-induced keystrokes, or API-backed dialog spoofing.
macos:unifiedlogprocess: spawn, exec
elastic/protections-artifacts
22 rules| Detection | Severity | Format |
|---|---|---|
| AppleScript Decoded via Base64 | Undefined | Elastic TOML |
| Base64 Encoded String Execution via Osascript | Undefined | Elastic TOML |
| Cocoa Applet Binary Execution | Undefined | Elastic TOML |
| Curl Hidden Binary Modification via Osascript | Undefined | Elastic TOML |
| Curl Output Piped to Osascript | Undefined | Elastic TOML |
| Dscl Execution via Osascript | Undefined | Elastic TOML |
| Executable File Access or Modification via Osascript | Undefined | Elastic TOML |
| Kerberos Config File Accessed by Osascript | Undefined | Elastic TOML |
| Osascript Execution via Piped AppleScript | Undefined | Elastic TOML |
| OSA Script Execution via Unsigned or Untrusted Parent | Undefined | Elastic TOML |
+ 12 more from elastic/protections-artifacts → showing the 10 highest-severity
elastic/detection-rules
17 rules| Detection | Severity | Format |
|---|---|---|
| Google Calendar C2 via Script Interpreter | High | Elastic TOML |
| Potential Etherhiding C2 via Blockchain Connection | High | Elastic TOML |
| Prompt for Credentials with Osascript | High | Elastic TOML |
| Suspicious Browser Child Process | High | Elastic TOML |
| Suspicious Curl to Jamf Endpoint | High | Elastic TOML |
| Suspicious Process Execution by Zoom | High | Elastic TOML |
| Apple Script Execution followed by Network Connection | Medium | Elastic TOML |
| Apple Scripting Execution with Administrator Privileges | Medium | Elastic TOML |
| Creation of Hidden Login Item via Apple Script | Medium | Elastic TOML |
| Execution via GitHub Actions Runner | Medium | Elastic TOML |
+ 7 more from elastic/detection-rules → showing the 10 highest-severity
SigmaHQ/sigma
9 rules| Detection | Severity | Format |
|---|---|---|
| Atomic MacOS Stealer - FileGrabber Activity | High | Sigma |
| Axios NPM Compromise Indicators - macOS | High | Sigma |
| JXA In-memory Execution Via OSAScript | High | Sigma |
| OSACompile Run-Only Execution | High | Sigma |
| Suspicious Microsoft Office Child Process - MacOS | High | Sigma |
| Clipboard Access Via OSAScript | Medium | Sigma |
| MacOS Scripting Interpreter AppleScript | Medium | Sigma |
| Osacompile Execution By Potentially Suspicious Applet/Osascript | Medium | Sigma |
| Suspicious Execution via macOS Script Editor | Medium | Sigma |
splunk/security_content
1 rule| Detection | Severity | Format |
|---|---|---|
| MacOS AMOS Stealer - Virtual Machine Check Activity | Undefined | SPL |