macOS JXA In-Memory Execution via osascript JavaScript eval and NSData URL loading
Detects osascript-launched in-memory JXA JavaScript execution patterns using eval and URL-based data loading.
- 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
Persistence
Priv Esc
Defense Evasion
Cred Access
Discovery
Lateral Movement
Collection
C2
Exfiltration
Impact
What it detects
This rule flags macOS process executions where the command line includes osascript with inline JavaScript evaluation, alongside logic that loads content into NSData from a URL. This pattern is significant because it supports in-memory execution workflows that can avoid writing a persistent script file. The detection relies on process creation telemetry with the full command line, looking for specific osascript flags and string indicators for JavaScript evaluation and URL-based NSData loading.
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 JXA In-Memory Execution via osascript JavaScript eval and NSData URL loading
id: 366e0aeb-72db-476a-b64a-9cc1bc1c5ee0
related:
- id: 1bc2e6c5-0885-472b-bed6-be5ea8eace55
type: derived
- id: f1408a58-0e94-4165-b80a-da9f96cf6fc3
type: derived
status: test
description: This rule flags macOS process executions where the command line includes osascript with inline JavaScript evaluation, alongside logic that loads content into NSData from a URL. This pattern is significant because it supports in-memory execution workflows that can avoid writing a persistent script file. The detection relies on process creation telemetry with the full command line, looking for specific osascript flags and string indicators for JavaScript evaluation and URL-based NSData loading.
references:
- https://redcanary.com/blog/applescript/
- https://github.com/SigmaHQ/sigma/blob/master/rules/macos/process_creation/proc_creation_macos_jxa_in_memory_execution.yml
author: Sohan G (D4rkCiph3r), Huntrule Team
date: 2023-01-31
tags:
- attack.t1059.002
- attack.t1059.007
- attack.execution
logsource:
product: macos
category: process_creation
detection:
selection_main:
CommandLine|contains|all:
- osascript
- " -e "
- eval
- NSData.dataWithContentsOfURL
selection_js:
- CommandLine|contains|all:
- " -l "
- JavaScript
- CommandLine|contains: .js
condition: all of selection_*
falsepositives:
- Unknown
level: high
license: DRL-1.1