Back to results

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.

Detections can measure how the public catalogue is used — which detections people look for, and which pages bring them here. It sets a cookie that recognises this browser for 180 days. It is never linked to an account and never follows you to other sites. Privacy notice