ELF File Creation Through Suspicious Executable
Description
This rule detects the creation of ELF files through a suspicious process executable. This could be indicative of an attacker attempting to execute a payload through a suspicious process. The rule excludes typical temporary directories, reducing false positives.
Query · eql
sequence by process.entity_id with maxspan=10s
[process where event.type == "start" and event.action == "exec" and
process.executable like (
"/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/*", "/var/run/*", "/boot/*", "/sys/*", "*/www/html/*",
"/lost+found/*", "/var/mail/*", "/var/www/*", "/media/*", "/proc/*/fd/*", "?memfd:*", "memfd:*",
"*/wp-content/*", "*/wp-includes/*", "*/wp-admin/*"
) and
not (
process.executable like (
"/tmp/par-*", "/tmp/prowlarr_update/Prowlarr.Update", "/tmp/sonarr_update/Sonarr.Update",
"/tmp/vmis.*/install/vmware-installer/vmis-launcher", "/tmp/tmp.*/rustup-init", "/tmp/.mount_*/installer",
"/tmp/octofence-agent-installer_*"
) or
process.group_leader.executable like ("/usr/sap/trans/INSTALL/SWPM/sapinst", "/oracle_agent/agent13c/agent/*/perl/bin/perl") or
process.parent.executable == "/opt/puppetlabs/puppet/bin/ruby" or
process.session_leader.executable == "/usr/lib/cargo/bin/sudo" or
process.working_directory like ("/data/bamboo/bamboo-agent-home/*", "/datadrive/*")
)
]
[file where event.type != "deletion" and file.Ext.header_bytes like "7f454c46*" and
not (
file.path like ("/tmp/*", "/var/tmp/*", "/home/*", "/root/*") or
(process.executable like "/tmp/makeself*" and file.path like "/usr/lib/modules/*/kernel/drivers/video/nvidia*.ko")
)
]