CmdID

CmdID / Rules / macOS

MacOS Scripting Interpreter AppleScript

A Sigma rule for process creation on macOS, by Alejandro Ortuno, oscd.community.

medium 1 ATT&CK technique 1 program it names 6 everyday examples trip it

What it looks for

its detection, as SigmaHQ writes it
detection:
  filter_optional_opencode:
    CommandLine|contains|all:
      - 'osascript'
      - ' -e '
      - 'set imageData to the clipboard'
      - 'set fileRef'
    ParentImage|endswith: 'opencode'
  selection:
    CommandLine|contains:
      - ' -e '
      - '.scpt'
      - '.js'
    Image|endswith: '/osascript'
  condition: selection and not 1 of filter_optional_*

The rule’s detection, its selections and fields in order of name. The whole rule, with its references and false positives, is on SigmaHQ, by Alejandro Ortuno, oscd.community, under the Detection Rule License 1.1. CmdID evaluates it on a command line alone: a test on what a command line cannot show, such as the parent process or the user, is not met.

Command lines that trip it

everyday examples from tldr-pages, CC BY 4.0, each read by CmdID

Run an AppleScript command on the page for osascript

osascript -e 'say "Hello world"'Identify

Run multiple AppleScript commands on the page for osascript

osascript -e 'say "Hello"' -e 'say "world"'Identify

Run a compiled (*.scpt), bundled (*.scptd), or plaintext (*.applescript) AppleScript file on the page for osascript

osascript path/to/apple.scptIdentify

Get the bundle identifier of an application (useful for open -b) on the page for osascript

osascript -e 'id of app "Application"'Identify

Run a JavaScript command on the page for osascript

osascript -l JavaScript -e "console.log('Hello world');"Identify

Run a JavaScript file on the page for osascript

osascript -l JavaScript path/to/script.jsIdentify

Programs and files it names

their pages here

ATT&CK

the techniques it is tagged with
T1059.002Command and Scripting Interpreter: AppleScript