Detection rules › Elastic

Execution of Memory File Descriptor via Suspicious Process

Source
github.com/elastic/protections-artifacts

This rule detects when a process executes a file descriptor in the proc (temporary) file system. 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.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
This rule detects when a process executes a file descriptor in the proc (temporary) file system. 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.
"""
id = "dccab9ab-1b40-4d52-85ed-cb41310b0160"
license = "Elastic License v2"
name = "Execution of Memory File Descriptor via Suspicious Process"
os_list = ["linux"]
reference = ["https://man7.org/linux/man-pages/man2/memfd_create.2.html"]
version = "1.0.8"

query = '''
process where event.type == "start" and event.action == "exec" and (
  process.executable regex """/proc/(self|[0-9]{1,7})/fd/[0-9]{1,7}""" or
  (
    process.args regex """/proc/(self|[0-9]{1,7})/fd/[0-9]{1,7}""" and
    process.executable like (
      "memfd:*", "?memfd:*", "/tmp/*", "/var/tmp/*", "/dev/shm/*", "./*", "/run/user/*", "/var/run/user/*",
      "/boot/*", "/sys/*", "/lost+found/*", "/proc/*", "/var/mail/*", "/root/*"
    )
  )
) and
not (
  process.parent.executable like (
    "/home/*/*steam*", "/usr/bin/podman", "./usr/bin/podman", "/dev/.buildkit_qemu_emulator",
    "/opt/omni/bin/drim/linux-amd64/coolie", "/usr/lib/systemd/systemd", "/usr/libexec/nordlayer/nordlayer-setcap",
    "/usr/bin/nordlayer", "/home/*/playground/general/edgeless/tools/contrast", "/bin/nvidia-cdi-hook",
    "/usr/bin/nvidia-ctk", "/sbin/apk", "/tmp/newroot/usr/bin/podman", "/usr/libexec/nordlayer/nordlayer-resolvconf",
    "/usr/sbin/docker-runc", "/usr/bin/runc", "/opt/teleport/system/bin/teleport", "/usr/local/bin/teleport",
    "/opt/sophos-spl/plugins/runtimedetections/bin/runtimedetections*", "/opt/fireeye/bin/rte-sensor", "/usr/local/sbin/thor-cloud-*",
    "/tmp/newroot/run/media/mm1/RIG_Drive_2/SteamLibrary/steamapps/common/SteamLinuxRuntime_4/pressure-vessel/bin/pressure-vessel-wrap",
    "/tmp/newroot/bin/sh", "/opt/sophos-spl/base/bin/launcher", "/usr/bin/containerd-shim-runc-v2", "/opt/sophos-spl/base/bin/sophos_watchdog.*"
  ) or
  process.executable like (
    "./home/*/.local/share/claude/versions/*", "/tmp/newroot/usr/bin/ls", "/tmp/newroot/var/lib/docker/rootfs/overlayfs/*/usr/bin/chown",
    "/tmp/newroot/*"
  ) or
  process.command_line like (
    "runc init", "/usr/local/bin/runc init", "*/home/*/.claude/shell-snapshots/snapshot*",
    "/proc/self/fd/? -config /etc/nordlayer/config.hcl", "storage-untar / /proc/self/fd/*",
    "/proc/self/exe init"
  ) or
  process.parent.command_line == "/opt/teleport/system/bin/teleport exec" or
  (
    process.args == "lxc-attach" and
    process.args == "-n"
  ) or
  (
    process.parent.executable in ("/bin/php", "/usr/bin/php") and
    process.args == "datadog-ipc-helper"
  ) or
  process.args like ("/usr/lib/systemd/systemd-executor", "/nix/store/*/lib/systemd/systemd-executor") or
  (
    process.executable like (
      "/tmp/newroot/proc/self/exe", "/tmp/newroot/home/*/.local/share/containers/storage/overlay/*/merged/proc/self/exe",
      "./usr/bin/podman"
    ) and
    process.args == "storage-untar"
  ) or
  (
    process.parent.executable == "/usr/libexec/docker/docker-runc-current" and
    process.command_line == "/proc/self/exe init"
  ) or
  (
    process.parent.executable == "/opt/sentinelone/bin/addon-host" and
    process.args like "/opt/sentinelone/addons/executables/SentinelAppVulnerability/*"
  ) or
  (
    process.executable == "memfd:spawn_worker_trampoline" and
    process.parent.executable == "/usr/local/bin/php"
  ) or
  (
    process.executable like "/tmp/agy-nsjail-exe-*" and
    process.parent.executable like "/home/*/resources/app/extensions/antigravity/bin/language_server_linux_x64"
  ) or
  (
    process.working_directory like "/var/lib/docker/overlay2/*/merged" and
    process.command_line == "/proc/self/exe init"
  ) or
  (
    process.executable == "memfd:spawn_worker_trampoline" and
    process.args == "datadog-ipc-helper"
  )
)
'''

min_endpoint_version = "9.1.4"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1106"
name = "Native API"
reference = "https://attack.mitre.org/techniques/T1106/"


[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1055"
name = "Process Injection"
reference = "https://attack.mitre.org/techniques/T1055/"
[[threat.technique.subtechnique]]
id = "T1055.009"
name = "Proc Memory"
reference = "https://attack.mitre.org/techniques/T1055/009/"


[[threat.technique]]
id = "T1620"
name = "Reflective Code Loading"
reference = "https://attack.mitre.org/techniques/T1620/"


[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "9.1.4"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and (
  process.executable regex """/proc/(self|[0-9]{1,7})/fd/[0-9]{1,7}""" or
  (
    process.args regex """/proc/(self|[0-9]{1,7})/fd/[0-9]{1,7}""" and
    process.executable like (
      "memfd:*", "?memfd:*", "/tmp/*", "/var/tmp/*", "/dev/shm/*", "./*", "/run/user/*", "/var/run/user/*",
      "/boot/*", "/sys/*", "/lost+found/*", "/proc/*", "/var/mail/*", "/root/*"
    )
  )
) and
not (
  process.parent.executable like (
    "/home/*/*steam*", "/usr/bin/podman", "./usr/bin/podman", "/dev/.buildkit_qemu_emulator",
    "/opt/omni/bin/drim/linux-amd64/coolie", "/usr/lib/systemd/systemd", "/usr/libexec/nordlayer/nordlayer-setcap",
    "/usr/bin/nordlayer", "/home/*/playground/general/edgeless/tools/contrast", "/bin/nvidia-cdi-hook",
    "/usr/bin/nvidia-ctk", "/sbin/apk", "/tmp/newroot/usr/bin/podman", "/usr/libexec/nordlayer/nordlayer-resolvconf",
    "/usr/sbin/docker-runc", "/usr/bin/runc", "/opt/teleport/system/bin/teleport", "/usr/local/bin/teleport",
    "/opt/sophos-spl/plugins/runtimedetections/bin/runtimedetections*", "/opt/fireeye/bin/rte-sensor", "/usr/local/sbin/thor-cloud-*",
    "/tmp/newroot/run/media/mm1/RIG_Drive_2/SteamLibrary/steamapps/common/SteamLinuxRuntime_4/pressure-vessel/bin/pressure-vessel-wrap",
    "/tmp/newroot/bin/sh", "/opt/sophos-spl/base/bin/launcher", "/usr/bin/containerd-shim-runc-v2", "/opt/sophos-spl/base/bin/sophos_watchdog.*"
  ) or
  process.executable like (
    "./home/*/.local/share/claude/versions/*", "/tmp/newroot/usr/bin/ls", "/tmp/newroot/var/lib/docker/rootfs/overlayfs/*/usr/bin/chown",
    "/tmp/newroot/*"
  ) or
  process.command_line like (
    "runc init", "/usr/local/bin/runc init", "*/home/*/.claude/shell-snapshots/snapshot*",
    "/proc/self/fd/? -config /etc/nordlayer/config.hcl", "storage-untar / /proc/self/fd/*",
    "/proc/self/exe init"
  ) or
  process.parent.command_line == "/opt/teleport/system/bin/teleport exec" or
  (
    process.args == "lxc-attach" and
    process.args == "-n"
  ) or
  (
    process.parent.executable in ("/bin/php", "/usr/bin/php") and
    process.args == "datadog-ipc-helper"
  ) or
  process.args like ("/usr/lib/systemd/systemd-executor", "/nix/store/*/lib/systemd/systemd-executor") or
  (
    process.executable like (
      "/tmp/newroot/proc/self/exe", "/tmp/newroot/home/*/.local/share/containers/storage/overlay/*/merged/proc/self/exe",
      "./usr/bin/podman"
    ) and
    process.args == "storage-untar"
  ) or
  (
    process.parent.executable == "/usr/libexec/docker/docker-runc-current" and
    process.command_line == "/proc/self/exe init"
  ) or
  (
    process.parent.executable == "/opt/sentinelone/bin/addon-host" and
    process.args like "/opt/sentinelone/addons/executables/SentinelAppVulnerability/*"
  ) or
  (
    process.executable == "memfd:spawn_worker_trampoline" and
    process.parent.executable == "/usr/local/bin/php"
  ) or
  (
    process.executable like "/tmp/agy-nsjail-exe-*" and
    process.parent.executable like "/home/*/resources/app/extensions/antigravity/bin/language_server_linux_x64"
  ) or
  (
    process.working_directory like "/var/lib/docker/overlay2/*/merged" and
    process.command_line == "/proc/self/exe init"
  ) or
  (
    process.executable == "memfd:spawn_worker_trampoline" and
    process.args == "datadog-ipc-helper"
  )
)

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argseq-nexcludes:process.args field:"process.args" value:"-n"
process.argseqlxc-attachexcludes:process.args field:"process.args" value:"lxc-attach"
process.argseqdatadog-ipc-helperexcludes:process.args field:"process.args" value:"datadog-ipc-helper"
process.executableeqmemfd:spawn_worker_trampolineexcludes:process.executable field:"process.executable" value:"memfd:spawn_worker_trampoline"
process.parent.executablein/bin/php, /usr/bin/phpexcludes:process.parent.executable field:"process.parent.executable" value:"/bin/php" field:"process.parent.executable" value:"/usr/bin/php"
process.argseqstorage-untarexcludes:process.args field:"process.args" value:"storage-untar"
process.executablewildcard/tmp/newroot/proc/self/exe, /tmp/newroot/home/*/.local/share/containers/storage/overlay/*/merged/proc/self/exe, ./usr/bin/podmanexcludes:process.executable field:"process.executable" value:"/tmp/newroot/proc/self/exe" field:"process.executable" value:"/tmp/newroot/home/*/.local/share/containers/storage/overlay/*/merged/proc/self/exe" field:"process.executable" value:"./usr/bin/podman"
process.argsstarts_with/opt/sentinelone/addons/executables/SentinelAppVulnerability/excludes:process.args field:"process.args" value:"/opt/sentinelone/addons/executables/SentinelAppVulnerability/"
process.parent.executableeq/opt/sentinelone/bin/addon-hostexcludes:process.parent.executable field:"process.parent.executable" value:"/opt/sentinelone/bin/addon-host"
process.command_lineeq/proc/self/exe initexcludes:process.command_line field:"process.command_line" value:"/proc/self/exe init"
process.parent.executableeq/usr/libexec/docker/docker-runc-currentexcludes:process.parent.executable field:"process.parent.executable" value:"/usr/libexec/docker/docker-runc-current"
process.working_directorywildcard/var/lib/docker/overlay2/*/mergedexcludes:process.working_directory field:"process.working_directory" value:"/var/lib/docker/overlay2/*/merged"
process.parent.executableeq/usr/local/bin/phpexcludes:process.parent.executable field:"process.parent.executable" value:"/usr/local/bin/php"
process.executablestarts_with/tmp/agy-nsjail-exe-excludes:process.executable field:"process.executable" value:"/tmp/agy-nsjail-exe-"
process.parent.executablewildcard/home/*/resources/app/extensions/antigravity/bin/language_server_linux_x64excludes:process.parent.executable field:"process.parent.executable" value:"/home/*/resources/app/extensions/antigravity/bin/language_server_linux_x64"
process.argswildcard/usr/lib/systemd/systemd-executor, /nix/store/*/lib/systemd/systemd-executorexcludes:process.args field:"process.args" value:"/usr/lib/systemd/systemd-executor" field:"process.args" value:"/nix/store/*/lib/systemd/systemd-executor"
process.command_linewildcardrunc init, /usr/local/bin/runc init, */home/*/.claude/shell-snapshots/snapshot*, /proc/self/fd/? -config /etc/nordlayer/config.hcl, storage-untar / /proc/self/fd/*, /proc/self/exe initexcludes:process.command_line
process.executablewildcard./home/*/.local/share/claude/versions/*, /tmp/newroot/usr/bin/ls, /tmp/newroot/var/lib/docker/rootfs/overlayfs/*/usr/bin/chown, /tmp/newroot/*excludes:process.executable
process.parent.command_lineeq/opt/teleport/system/bin/teleport execexcludes:process.parent.command_line field:"process.parent.command_line" value:"/opt/teleport/system/bin/teleport exec"
process.parent.executablewildcard/home/*/*steam*, /usr/bin/podman, ./usr/bin/podman, /dev/.buildkit_qemu_emulator, /opt/omni/bin/drim/linux-amd64/coolie, /usr/lib/systemd/systemd, /usr/libexec/nordlayer/nordlayer-setcap, /usr/bin/nordlayer, /home/*/playground/general/edgeless/tools/contrast, /bin/nvidia-cdi-hook, /usr/bin/nvidia-ctk, /sbin/apk, /tmp/newroot/usr/bin/podman, /usr/libexec/nordlayer/nordlayer-resolvconf, /usr/sbin/docker-runc, /usr/bin/runc, /opt/teleport/system/bin/teleport, /usr/local/bin/teleport, /opt/sophos-spl/plugins/runtimedetections/bin/runtimedetections*, /opt/fireeye/bin/rte-sensor, /usr/local/sbin/thor-cloud-*, /tmp/newroot/run/media/mm1/RIG_Drive_2/SteamLibrary/steamapps/common/SteamLinuxRuntime_4/pressure-vessel/bin/pressure-vessel-wrap, /tmp/newroot/bin/sh, /opt/sophos-spl/base/bin/launcher, /usr/bin/containerd-shim-runc-v2, /opt/sophos-spl/base/bin/sophos_watchdog.*excludes:process.parent.executable

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • exec
field:"EventType" kind:eq value:"exec"
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.argsregex_match
  • /proc/(self|[0-9]{1,7})/fd/[0-9]{1,7}
field:"process.args" kind:regex_match value:"/proc/(self|[0-9]{1,7})/fd/[0-9]{1,7}"
process.executableregex_match
  • /proc/(self|[0-9]{1,7})/fd/[0-9]{1,7}
field:"Image" kind:regex_match value:"/proc/(self|[0-9]{1,7})/fd/[0-9]{1,7}"
process.executablewildcard
  • ./*
  • /boot/*
  • /dev/shm/*
  • /lost+found/*
  • /proc/*
  • /root/*
  • /run/user/*
  • /sys/*
  • /tmp/*
  • /var/mail/*
  • /var/run/user/*
  • /var/tmp/*
  • ?memfd:*
  • memfd:*
field:"Image" kind:wildcard