Suspicious Curl File Download and Execution
Description
Detects when Curl downloads a file to a suspicious directory and that file is immediately executed via the same effective parent process. This behavior is often used by threat actors to download and execute additional payloads or tooling on a target system. While the use of Curl is not inherently malicious, the combination of downloading to temporary or shared directories followed by immediate execution is indicative of potentially malicious activity.
Query · eql
sequence with maxspan=15s
[file where event.action == "modification" and process.name in ("curl", "nscurl") and file.path like ("/Users/Shared/*", "/tmp/*", "/private/tmp/*", "/var/tmp/*", "/private/var/tmp/*") and
not Effective_process.executable like ("/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon",
"/usr/local/jamf/bin/jamf") and
not file.extension == "pkg"] as event0
[process where event.type == "start" and event.action == "exec" and process.name in ("bash", "sh", "zsh") and stringcontains~(event0.file.name, process.command_line)]