Curl Execution via Application Shell Script
Description
Detects the abnormal spawning of curl or nscurl by a shell script within an applications directory structure. Threat actors have executed and abused shell scripts within a benign applications directory structures in order to evade detection and download a second stage payload. This specific activity has been observed when the shell script creates a new shell child process ,via a fork, which is then used to execute curl or nscurl. The use of shell scripts within a macOS application to execute curl is highly abnormal espcially in this specific manner.
Query · eql
sequence by process.parent.entity_id with maxspan=30s
[process where event.type == "start" and event.action == "fork" and process.name like~ ("bash", "sh", "zsh", "tclsh*") and
process.args_count == 2 and process.args like~ ("/Applications/*", "/Volumes/*", "/Users/*/Applications/*") and
process.parent.name like~ ("bash", "sh", "zsh", "tclsh*")]
[process where event.type == "start" and event.action == "exec" and process.name in ("curl", "nscurl") and
process.args in ("-o", "--output", "-O", "--remote-name") and
not process.args like~
("https://github.com/*",
"http://localhost:*",
"https://localhost:*",
"https://download.elastic.co/cloud/elastic-cloud-enterprise.sh") and
not process.args == "-X" and
not process.args == "-H" and
not process.args == "-d"]