Shell Execution of Non-Executable File
Description
Detects the execution of an un-executable file, per file extension, via a shell interpreter. Sometimes threat actors will masquerade their payloads as non-executable files in order to avoid suspicion and go unnoticed.
Query · eql
process where event.type == "start" and event.action == "exec" and process.args_count == 2 and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
process.args in (
"/bin/bash", "/usr/bin/bash", "/bin/sh", "/usr/bin/sh", "/bin/dash", "/usr/bin/dash", "/bin/zsh", "/usr/bin/zsh",
"/bin/tcsh", "/usr/bin/tcsh", "/bin/csh", "/usr/bin/csh", "/bin/ksh", "/usr/bin/ksh", "/bin/fish", "/usr/bin/fish"
) and
process.args like ("*.pid", "*.txt", "*.json", "*.bin", "*.log", "*.dat") and
not (
process.args in ("/opt/config/example.txt", "/var/lib/git/beinformed.git/subgit/authors.txt") or
process.parent.args like ("/sbin/init", "/var/opt/eset/RemoteAdministrator/Agent/*") or
process.parent.executable in ("/usr/bin/emscli", "./runc") or
process.command_line in (
/* Manage Engine UEMS Agent */
"/bin/bash /opt/DesktopCentral/UEMS_LinuxAgent.bin", "/bin/bash ./UEMS_LinuxAgent.bin"
)
)