Potential Reverse Shell via Named Pipe
Description
This rule detects the creation of a reverse shell through the use of named pipes. Attackers may leverage named pipes to evade detection and establish persistence onto a target system.
Query · eql
process where event.type == "start" and event.action == "exec" and
process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and (
(process.name == "mknod" and process.args like ("/tmp/*", "/var/tmp/*", "/dev/shm/*") and process.args_count <= 5) or
(
process.name == "mkfifo" and
process.parent.args == "-c" and
process.parent.command_line like "*rm*" and
process.parent.command_line like "*|*" and
process.parent.command_line regex ".*[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}.*"
)
) and
not (
(process.name == "mknod" and process.args like ("/var/tmp/dracut*", "/tmp/dracut.*", "/var/tmp/portage/*", "/tmp/dib_build*", "/tmp/bootstrap-salt.logpipe")) or
(process.executable == "/usr/lib/cargo/bin/coreutils/mknod" and process.args like "/tmp/tmp.*/test-dev-null")
)