Potential Fileless Execution via Memory File Descriptor by LoLBin
Description
This rule detects when a process executes a file descriptor in the proc (temporary) file system via a LoLBin. This activity indicates an active attempt to execute a fileless payload and should be considered highly abnormal or suspicious. This activity can occur when the memfd syscall is utilized to create a memory resident file, like a payload, and then uses it to execute a process via a command and control channel via a LoLBin, resulting in an exec event.
Query · eql
process where event.type == "start" and event.action == "exec" and process.interactive == true and (
process.name in (
"bash", "dash", "sh", "tcsh", "tclsh", "wish", "csh", "zsh", "ksh", "fish", "mksh",
"busybox", "pwsh", "node", "nodejs", "deno", "bun", "base64", "rscript", "escript",
"r", "julia", "mono", "dotnet", "dotnet-ef", "groovy", "kotlin", "scala", "erlang",
"ocaml", "ocamlopt", "ld.so", "ld-linux-x86-64.so.2", "awk", "gawk", "mawk", "nawk",
"env", "timeout", "nice", "stdbuf", "setsid", "setarch", "unshare", "nsenter", "flock",
"nohup", "runuser", "sudo", "snap", "snap-confine", "snap-exec", "erlexec", "beam.smp",
"java", "javaw"
) or
process.name like ("python*", "perl*", "ruby*", "lua*", "php*", "qemu-*-static")
) and
process.args regex """/proc/(self|[0-9]{1,7})/fd/[0-9]{1,7}""" and
not (
process.command_line in ("ln -f -s /proc/1/fd/2 /docker.stderr", "ln -f -s /proc/1/fd/1 /docker.stdout") or
process.parent.command_line like "*/home/*/.claude/shell-snapshots/snapshot-*" or
process.parent.executable like (
"/opt/omni/bin/drim/linux-amd64/coolie", "/bin/k3s", "/sbin/upstart", "/opt/hrt/hrtpylon-*/bin/python3.*",
"/data/k3s/*/bin/k3s", "/var/lib/docker/overlay2/*/bin/k3s", "/var/lib/rancher/k3s/*/bin/k3s",
"/usr/libexec/apptainer/bin/starter"
) or
process.executable like "/home/*/core3/plz-out/bin/third_party/python3/cpython/usr/python3*/bin/python3.*" or
(
process.parent.executable == "/sbin/apk" and
process.parent.args in ("add", "del", "upgrade")
) or
(
process.parent.executable == "/sbin/init" and
process.name == "sh" and
process.args == "-e"
) or
(
process.name == "busybox" and
process.command_line == "tee -a /proc/1/fd/1"
) or
(
process.executable == "/bin/busybox" and
process.args == "sh" and
process.args in ("/usr/bin", "/usr/sbin")
)
)