process where host.os.type == "macos" and event.type in ("start", "process_started") and process.parent.name == "com.apple.foundation.UserScriptService" and
((process.name like~ ("osascript", "python*", "tcl*", "node", "perl", "ruby", "php")) or
(process.name in ("bash", "csh", "zsh", "sh") and process.args == "-c")) and
not process.args like ("/Users/*/Library/Scripts/*", "/Users/*/Library/Application Scripts/*", "/Library/Scripts/*")
Install detection rules in Elastic Security
Detect Persistence via Folder Action Script in the Elastic Security detection engine by installing this rule into your Elastic Stack.
To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(opens in a new tab or window).