Detection rules › Elastic
Potential Memory File Descriptor Process Execution
This rule detects when a process is executed from a memory file descriptor (memfd). Attackers may use memfd to create and execute code directly in memory, bypassing traditional file-based detection mechanisms. The use of memfd for process execution is uncommon and may indicate an attempt to evade security controls.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth |
Rule body
[rule]
description = """
This rule detects when a process is executed from a memory file descriptor (memfd). Attackers may use memfd to create
and execute code directly in memory, bypassing traditional file-based detection mechanisms. The use of memfd for process
execution is uncommon and may indicate an attempt to evade security controls.
"""
id = "b2bd6ad2-7954-4eb5-863f-fc8318ed15d7"
license = "Elastic License v2"
name = "Potential Memory File Descriptor Process Execution"
os_list = ["linux"]
reference = ["https://man7.org/linux/man-pages/man2/memfd_create.2.html"]
version = "1.0.4"
query = '''
process where event.type == "start" and event.action == "exec" and (
process.executable like ("?memfd:*", "memfd:*") or
process.parent.executable like ("?memfd:*", "memfd:*")
) and
not (
process.executable in (
"/usr/bin/fusermount", "/usr/bin/fusermount3", "memfd:runc_cloned:/proc/self/exe",
"memfd:buildah-chroot-runtime", "memfd:buildah-chroot-exec", "memfd:lxc-attach", "/usr/sbin/logrotate"
) or
process.executable like "memfd:runc_cloned:/run/nvidia-ctk-hook/*" or
process.parent.executable like (
"/usr/libexec/nordlayer/nordlayer-resolvconf", "/nix/store/*/bin/buildah",
"/opt/teleport/system/bin/teleport", "memfd:teleport-sessionhelper",
"memfd:buildah-chroot-exec", "/usr/lib/openssh/sshd-session", "memfd:lxc-attach",
"/usr/bin/nvidia-cdi-hook", "/opt/sophos-spl/plugins/runtimedetections/bin/runtimedetections.*",
"/opt/appimagelauncher.AppDir/usr/lib/x86_64-linux-gnu/appimagelauncher/binfmt-bypass",
"/usr/bin/nordlayer"
) or
(
process.working_directory == "/run/nordlayer" and
process.parent.command_line in (
"/proc/self/fd/4 -config /etc/nordlayer/config.hcl",
"/dev/fd/4 -config /etc/nordlayer/config.hcl"
)
) or
(process.parent.executable == "/usr/local/bin/php" and process.executable == "memfd:spawn_worker_trampoline") or
(process.parent.executable like "/opt/teleport/default/versions/*/bin/teleport" and process.executable == "memfd:teleport-sessionhelper") or
(process.parent.command_line == "runc init" and process.parent.executable == "memfd:runc_cloned:/proc/self/exe") or
(process.parent.executable == "/usr/bin/nvidia-container-cli" and process.executable == "memfd:/sbin/ldconfig.real") or
(process.parent.executable == "/usr/sbin/nordlayerd" and process.parent.command_line == "/usr/sbin/nordlayerd -config /etc/nordlayer/config.hcl") or
(process.parent.executable == "/usr/bin/nordlayer-tray" and process.executable == "memfd:fdexe") or
(process.parent.executable == "/opt/fireeye/bin/rte-sensor" and process.executable like "memfd:/capsule8-sensor-*")
)
'''
min_endpoint_version = "7.15.0"
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 = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and (
process.executable like ("?memfd:*", "memfd:*") or
process.parent.executable like ("?memfd:*", "memfd:*")
) and
not (
process.executable in (
"/usr/bin/fusermount", "/usr/bin/fusermount3", "memfd:runc_cloned:/proc/self/exe",
"memfd:buildah-chroot-runtime", "memfd:buildah-chroot-exec", "memfd:lxc-attach", "/usr/sbin/logrotate"
) or
process.executable like "memfd:runc_cloned:/run/nvidia-ctk-hook/*" or
process.parent.executable like (
"/usr/libexec/nordlayer/nordlayer-resolvconf", "/nix/store/*/bin/buildah",
"/opt/teleport/system/bin/teleport", "memfd:teleport-sessionhelper",
"memfd:buildah-chroot-exec", "/usr/lib/openssh/sshd-session", "memfd:lxc-attach",
"/usr/bin/nvidia-cdi-hook", "/opt/sophos-spl/plugins/runtimedetections/bin/runtimedetections.*",
"/opt/appimagelauncher.AppDir/usr/lib/x86_64-linux-gnu/appimagelauncher/binfmt-bypass",
"/usr/bin/nordlayer"
) or
(
process.working_directory == "/run/nordlayer" and
process.parent.command_line in (
"/proc/self/fd/4 -config /etc/nordlayer/config.hcl",
"/dev/fd/4 -config /etc/nordlayer/config.hcl"
)
) or
(process.parent.executable == "/usr/local/bin/php" and process.executable == "memfd:spawn_worker_trampoline") or
(process.parent.executable like "/opt/teleport/default/versions/*/bin/teleport" and process.executable == "memfd:teleport-sessionhelper") or
(process.parent.command_line == "runc init" and process.parent.executable == "memfd:runc_cloned:/proc/self/exe") or
(process.parent.executable == "/usr/bin/nvidia-container-cli" and process.executable == "memfd:/sbin/ldconfig.real") or
(process.parent.executable == "/usr/sbin/nordlayerd" and process.parent.command_line == "/usr/sbin/nordlayerd -config /etc/nordlayer/config.hcl") or
(process.parent.executable == "/usr/bin/nordlayer-tray" and process.executable == "memfd:fdexe") or
(process.parent.executable == "/opt/fireeye/bin/rte-sensor" and process.executable like "memfd:/capsule8-sensor-*")
)
Exclusions
The rule actively suppresses these predicates.
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.parent.executable | wildcard |
| field:"ParentImage" kind:wildcard |