macOS AppleScript Execution via osascript with -e, .scpt, or .js

Flags osascript usage on macOS with -e and script indicators consistent with executing AppleScript.

FreeReviewedSigma · Medium · v2
Product
macos
Category
process_creation
Author
Alejandro Ortuno, oscd.community (SigmaHQ), DRL 1.1
Published
2020-10-21
Updated
2026-07-31
title: macOS AppleScript Execution via osascript with -e, .scpt, or .js
id: 90b48d2b-9283-42cb-88bd-9e5824673bf3
status: test
description: This rule identifies process executions where osascript is launched with an -e argument and references to AppleScript script files or JavaScript components (via .scpt or .js). Attackers can use AppleScript execution to automate actions and run code through macOS scripting interfaces. It relies on macOS process creation telemetry capturing the executed image path and command-line arguments.
references:
  - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1059.002/T1059.002.md
  - https://redcanary.com/blog/applescript/
  - https://github.com/SigmaHQ/sigma/blob/master/rules/macos/process_creation/proc_creation_macos_applescript.yml
author: Alejandro Ortuno, oscd.community, Huntrule Team
date: 2020-10-21
modified: 2026-05-21
tags:
  - attack.execution
  - attack.t1059.002
logsource:
  category: process_creation
  product: macos
detection:
  selection:
    Image|endswith: /osascript
    CommandLine|contains:
      - " -e "
      - .scpt
      - .js
  filter_optional_opencode:
    ParentImage|endswith: opencode
    CommandLine|contains|all:
      - osascript
      - " -e "
      - set imageData to the clipboard
      - set fileRef
  condition: selection and not 1 of filter_optional_*
falsepositives:
  - Application installers might contain scripts as part of the installation process.
level: medium
license: DRL-1.1
related:
  - id: 1bc2e6c5-0885-472b-bed6-be5ea8eace55
    type: derived