File Download Piped to Script Interpreter
Description
Detects when curl or wget is utilized to download a payload and pipe it to a script interpreter for immediate execution. This activity occurs when a file is downloaded and passed to a interpreter via a shell.
Query · eql
sequence with maxspan=2m
[process where event.type == "start" and event.action == "exec" and
process.name in ("curl", "nscurl") and
process.args in ("-o", "--output", "-O", "-o-", "O", "-dl", "--download", "-ld", "--large-download") and
process.command_line : ("/Users/Shared/*", "/tmp/*", "/private/tmp/*", "/var/tmp/*", "/private/var/tmp/*")] by process.Ext.effective_parent.entity_id
[file where event.action == "modification" and process.name in ("curl", "nscurl") and file.extension in ("sh", "scpt")] by Effective_process.entity_id
[process where event.type == "start" and event.action == "exec" and
process.name like~ ("python*", "perl*", "ruby*", "sh", "bash", "zsh", "osascript") and
process.parent.name in ("sh", "bash", "zsh", "osascript") and
((process.args like~ ("python*", "perl*", "ruby*", "bash", "sh", "zsh", "osascript") and process.args_count == 1) or
(process.args in ("bash", "sh", "zsh") and process.args == "-s" and process.args_count <= 2))] by process.Ext.effective_parent.entity_id