Has utilized AppleScript to include set keychainPassword to do shell script to execute shell command that retrieves passwords from the macOS keychain.1
AppleScript T1059.002
- Tactic
- Execution
- Platform
- macOS
- Version
- 1.3
- Created
- 09 March 2020
- Last modified
- 12 May 2026
- Contributor
- Phil Stokes, SentinelOne
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 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.
AppleScript MITRE reference T1059.002
6 software entries are documented implementing this technique. MITRE files each as a tool or as malware; newest first, then by how many groups carry them.
Can use osascript to generate a password-stealing prompt, duplicate files and folders, and set environmental variables.12
Has used osascript to call itself via the do shell script command in the Launch Agent .plist file.1
Uses AppleScript's osascript -e command to launch ThiefQuest's persistence via Launch Agent and Launch Daemon. 1
Can use AppleScript to inject malicious JavaScript into a browser.1
Uses AppleScript to create a login item for persistence.1
All 6 software entries for this technique
Offense vs defense T1059.002
Is defensive coverage keeping up with adversary use? Eight counts, each ranked against all 697 ATT&CK techniques. Attack sits left, defense right, so a shape leaning left means adversaries are better documented here than defenders are equipped. Hover any spoke for its percentile and the share of techniques that have more. The timeline below shows when each side arrived.
How it got here
Adversary activity (campaign spans) over cumulative rule output. Each source is plotted independently from zero, so neither line includes the other. Campaign dates are year-granularity.
AppleScript detection strategy DET0414
MITRE names one behaviour worth catching for this technique and breaks it into 1 analytic, one per platform. Each carries the log sources it needs and the fields you tune per environment.
Detection of AppleScript-Based Execution on macOS
AN1164 · macOS
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.
Log sources
The data this analytic draws on. You do not need every component — each one you already collect covers part of it. Each links to its ATT&CK record.
| Data component | Name | Channel |
|---|---|---|
| Process CreationDC0032 | macos:unifiedlog | process: spawn, exec |
Tunable fields
MITRE calls these the analytic’s mutable elements: the thresholds and filters you set for your own environment.
| Field | What you tune |
|---|---|
| ScriptInvocationParent | Identify rare or suspicious parent processes launching AppleScript (e.g., Safari, Mail, msedge). |
| TimeWindow | Flag AppleScript execution during user-inactive hours, especially for automation frameworks. |
| AppleEventActionType | Filter AppleEvent-based automation involving UI interaction, keystrokes, or remote control. |
| TargetApplicationSet | Scope AppleScript use toward security-sensitive apps (e.g., Terminal, ssh, Keychain Access). |
| ExecutionPathRegex | Restrict to unusual paths like /tmp/, ~/Library/, or embedded in Automator workflows. |
Require that all AppleScript be signed by a trusted developer ID before being executed - this will prevent random AppleScript code from executing. This subjects AppleScript code to the same scrutiny as other .app files passing through Gatekeeper.
Use application control where appropriate.
Tests from Atomic Red Team (MIT licence) · technique definition