Execution of a Recently Created File with Malicious Reputation
Description
Identifies the execution of a recently created file with malicious public reputation. Candidate files include those created in commonly abused filesystem locations or written by living-off-the-land utilities, interpreters, or processes executing from suspicious paths. Adversaries may use these methods to stage and execute payloads while blending with legitimate system activity.
Query · eql
sequence with maxspan=1m
[file where event.type == "creation" and
(
file.path like (
"/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/*", "/var/run/*", "/boot/*", "/sys/*", "*/www/html/*",
"/lost+found/*", "/proc/*", "/var/mail/*", "/var/www/*", "/mnt/*", "/media/*", "/home/*/*", "/root/*",
"/bin/*", "/usr/bin/*", "/usr/local/bin/*", "/sbin/*", "/usr/sbin/*", "/usr/local/sbin/*", "/etc/*",
"/lib/*", "/lib32/*", "/lib64/*", "/libx32/*", "/usr/lib/*", "/usr/lib32/*", "/usr/lib64/*",
"/usr/libx32/*", "/usr/local/lib/*", "/usr/local/lib32/*", "/usr/local/lib64/*", "/usr/local/libx32/*",
"/libexec/*", "/usr/libexec/*", "/usr/local/libexec/*", "/var/lib/*", "*/wp-content/*", "*/wp-includes/*",
"*/wp-admin/*"
) or
file.name like ".*" or
process.name in (
"curl", "wget", "ftp", "tftp", "scp", "rsync", "bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish",
"busybox", "timeout", "env", "cp", "mv", "install", "dd", "tee", "touch", "tar", "gzip", "gunzip", "bzip2",
"bunzip2", "xz", "unxz", "zip", "unzip", "7z", "bun"
) or
process.name like (".*", "python*", "perl*", "php*", "ruby*", "lua*", "node*", "deno*") or
process.executable like (
"./*", "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/*", "/var/run/*", "/boot/*", "/sys/*", "*/www/html/*",
"/lost+found/*", "/proc/*", "/var/mail/*", "/var/www/*", "/mnt/*", "/media/*", "/home/*/*", "/root/*",
"*/wp-content/*", "*/wp-includes/*", "*/wp-admin/*", "?memfd:*", "memfd:*"
)
)
] as event0
[process where event.type == "start" and event.action == "exec" and process.hash.sha256 != null and
stringcontains~(process.executable, event0.file.path)]