Detection of Fileless Execution via memfd_create on Linux
This brief details a detection strategy for identifying potential fileless execution on Linux platforms by monitoring the memfd_create syscall for anomalous process lineage and execution paths.
This brief addresses the risk of fileless execution on Linux systems using the memfd_create system call. The technique allows an attacker to decrypt an ELF payload into an anonymous, memory-backed file, effectively bypassing traditional disk-based security controls. By executing the payload directly from memory - often via /proc/self/fd - malicious actors can execute code without leaving persistent disk artifacts.
Defenders can detect this behavior by monitoring for memfd_create events where the combination of host ID, parent executable, and process executable path has not been previously observed. This approach focuses on behavioral anomalies, helping to distinguish between legitimate system utility usage (such as JIT compilation or software self-updates) and malicious reflective code loading. Because this detection relies on baseline behavioral analysis, organizations should tune these detections against their specific Linux environment to reduce false positives from routine administrative or runtime-specific activity.
Impact
Successful fileless execution enables attackers to maintain stealth, evade host-based security tools, and minimize the footprint of their malicious operations. If used by an adversary, this technique can lead to long-term persistence, credential theft, and unauthorized command execution. Impacts are broad, potentially affecting any enterprise Linux environment, containerized workload, or cloud-native infrastructure that lacks specific behavioral monitoring for process ancestry and memory-backed execution.
Recommendation
- Deploy behavioral monitoring for the
memfd_createsyscall on all critical Linux endpoints using EDR capabilities. - Implement the provided detection logic to baseline process lineage and alert on new, unseen combinations of parent/child executables involving memfd-backed execution.
- Establish a process for triaging alerts by reconstructing process ancestry and examining
/proc/<pid>/exemappings before process termination. - Apply host-based sandboxing, such as systemd unit sandboxing or seccomp profiles, to limit the ability of non-privileged services to execute code from memory-backed or temporary filesystem paths.
- Regularly audit and baseline software that legitimately requires
memfd_createfunctionality (e.g., container runtimes, language JIT compilers) to prevent alert fatigue.
Immediate actions
Deploy the rule to monitor for anomalous memfd_create activity.
Threat Hunt
Search for processes executing from /proc/*/fd/*.
Data: Process creation events
Enrichment needed
- Known-good baselines (SOC) Necessary to reduce noise from legitimate system tools.
Detection coverage 1
Potential Fileless Execution via Unusual memfd Create Call
mediumDetects memfd_create syscall events where the combination of host, parent process, and executable path has not been seen before, indicating potential fileless execution.
Detection queries are available on the platform. Get full rules →