macOS OSACompile Run-Only Script Execution
Flags osacompile commands on macOS using run-only (-x) with inline script (-e) execution.
- Product
- macos
- Category
- process_creation
- Author
- Sohan G (D4rkCiph3r) (SigmaHQ), DRL 1.1
- Published
- 2023-01-31
- Updated
- 2026-07-31
ATT&CK techniques
ExecutionRecon
Resource Dev
Initial Access
Execution
Persistence
Priv Esc
Defense Evasion
Cred Access
Discovery
Lateral Movement
Collection
C2
Exfiltration
Impact
What it detects
This rule flags process creations where the command line includes OSACompile with run-only indicators, specifically the presence of ' -x ' and ' -e '. Attackers can use OSACompile to execute embedded AppleScript/OSAScript content directly, which can support short-lived or hard-to-review execution flows. Detection relies on macOS process creation telemetry, matching command-line substrings in the spawned process.
Reporting behind it
Changelog
v2- v2Candidate ingested via manual entry.2026-07-31
- v1No changelog recorded for this version.2026-07-30
Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.
title: macOS OSACompile Run-Only Script Execution
id: 1c8c6087-726e-427f-b073-c6045857059f
status: test
description: This rule flags process creations where the command line includes OSACompile with run-only indicators, specifically the presence of ' -x ' and ' -e '. Attackers can use OSACompile to execute embedded AppleScript/OSAScript content directly, which can support short-lived or hard-to-review execution flows. Detection relies on macOS process creation telemetry, matching command-line substrings in the spawned process.
references:
- https://redcanary.com/blog/applescript/
- https://ss64.com/osx/osacompile.html
- https://github.com/SigmaHQ/sigma/blob/master/rules/macos/process_creation/proc_creation_macos_osacompile_runonly_execution.yml
author: Sohan G (D4rkCiph3r), Huntrule Team
date: 2023-01-31
tags:
- attack.t1059.002
- attack.execution
logsource:
product: macos
category: process_creation
detection:
selection:
CommandLine|contains|all:
- osacompile
- " -x "
- " -e "
condition: selection
falsepositives:
- Unknown
level: high
license: DRL-1.1
related:
- id: b9d9b652-d8ed-4697-89a2-a1186ee680ac
type: derived