Detectionmediumtest

MacOS Scripting Interpreter AppleScript

Detects execution of AppleScript of the macOS scripting language AppleScript.

Open in Detection LabConvert ruleBuild Package
Alejandro Ortuno, oscd.communityCreated 2020-10-21Updated 2026-05-211bc2e6c5-0885-472b-bed6-be5ea8eace55macos
Log Source
macOSProcess Creation
ProductmacOS← raw: macos
CategoryProcess Creation← raw: process_creation

Events generated when a new process is spawned on the system. Covers command-line arguments, parent/child relationships, and process metadata.

Detection Logic
Detection Logic2 selectors
detection:
    selection:
        Image|endswith: '/osascript'
        CommandLine|contains:
            - ' -e '
            - '.scpt'
            - '.js'
    filter_optional_opencode:
        # OpenCode uses osascript to handle copying text from the TUI on MacOS devices. See https://github.com/anomalyco/opencode/blob/ca723f1cbc6fc4244ae57e61e9de8c4e37380ed4/packages/opencode/src/cli/cmd/tui/util/clipboard.ts#L65 for reference.
        ParentImage|endswith: 'opencode'
        CommandLine|contains|all:
            - 'osascript'
            - ' -e '
            - 'set imageData to the clipboard'
            - 'set fileRef'
    condition: selection and not 1 of filter_optional_*
False Positives

Application installers might contain scripts as part of the installation process.

MITRE ATT&CK
Rule Metadata
Rule ID
1bc2e6c5-0885-472b-bed6-be5ea8eace55
Status
test
Level
medium
Type
Detection
Created
2020-10-21
Modified
2026-05-21
Path
rules/macos/process_creation/proc_creation_macos_applescript.yml
Raw Tags
attack.executionattack.t1059.002
View on GitHub