Unusually large OSA script execution via Shell Command
Description
Detects when an unusually large OSA script is executed by Osascript via a shell command. This specific invocation of an OSA script is unique and very suspicious if not malicious. Recently this method of executing OSA script has been observed being used by many different stealer samples. These stealers will include the malicious OSA script in their binary, usually encoded, then execute it via the default shell.
Query · eql
sequence with maxspan=5s
[process where event.type == "start" and event.action == "exec" and (process.name in ("bash", "sh", "zsh", "dash", "csh", "tcsh", "ksh", "tclsh", "fish") or process.name like "tclsh*") and
process.args == "-c" and process.args_count == 3] by process.entity_id
[process where event.type == "start" and event.action == "exec" and process.name == "osascript" and
process.args == "-e" and process.args_count == 3 and
process.command_line == null] by process.parent.entity_id