Currently viewing ATT&CK v7.2 which was live between July 8, 2020 and October 26, 2020. Learn more about the versioning system or see the live site.
Register to stream the next session of ATT&CKcon Power Hour November 12

Command and Scripting Interpreter: AppleScript

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. [1] These AppleEvent messages can be easily scripted with AppleScript for local or remote execution.

osascript executes AppleScript and any other Open Scripting Architecture (OSA) language scripts. A list of OSA languages installed on a system can be found by using the osalang program. AppleEvent messages can be sent independently or as part of a script. These events can locate open windows, send keystrokes, and interact with almost any open application locally or remotely.

Adversaries can use this 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 though), but can interact with applications if they're already running remotely. Since this is a scripting language, it can be used to launch more common techniques as well such as a reverse shell via Python[2]. Scripts can be run from the command-line via osascript /path/to/script or osascript -e "script here".

ID: T1059.002
Sub-technique of:  T1059
Tactic: Execution
Platforms: macOS
Permissions Required: User
Data Sources: Process command-line parameters, Process monitoring
Version: 1.0
Created: 09 March 2020
Last Modified: 14 April 2020

Procedure Examples

Name Description
Bundlore

Bundlore can use AppleScript to inject malicious JavaScript into a browser.[5]

Dok

Dok uses AppleScript to create a login item for persistence.[4]

Mitigations

Mitigation Description
Code Signing

Require that all AppleScript be signed by a trusted developer ID before being executed - this will prevent random AppleScript code from executing.[3] This subjects AppleScript code to the same scrutiny as other .app files passing through Gatekeeper.

Execution Prevention

Use application control where appropriate.

Detection

Monitor for execution of AppleScript through osascript that may be related to other suspicious behavior occurring on the system.

References