← All Threat Hunting ReportsThreat Hunting Exercise

Threat Hunting Exercise: Analyzing Linux Fileless Execution via memfd_create Dataset

This hunt uses a simulated Linux auditd dataset (linux_memfd_2022-08-23T140000.json) capturing T1620: Reflective Code Loading on Linux, where an attacker uses the memfd_create() syscall to create an anonymous, in-memory file descriptor, write an ELF binary into it, and execute it directly via fexecve() - leaving no file ever written to disk.

Step 1: Hypothesis Formation

Hypothesis: A process calls memfd_create() to obtain an anonymous memory file descriptor, writes ELF binary content into it, and then executes it via fexecve() or by referencing /proc/self/fd/<N> - resulting in a running process with no backing file on disk, which standard file-based antivirus/EDR scanning cannot inspect. Indicators:

Null Hypothesis: A legitimate, container-runtime-adjacent tool (some language runtimes and JIT compilers legitimately use memfd for internal purposes) is responsible. Invalidate by checking the process's parent lineage and confirming it is not a known runtime (e.g., .NET's dotnet, certain sandboxing tools) with a documented memfd use case.

Rationale: Fileless execution via memfd_create is specifically designed to defeat disk-scanning antivirus and forensic file-carving, since the executed binary never has an on-disk representation; this hunt validates syscall-sequence monitoring (memfd_create → write → execve-via-fd) as the only reliable detection method, since file-hash or path-based tooling has nothing to inspect.

Step 2: Data Sources and Scope

Step 3: Key Findings

Parsed events (5 shown) confirm a Python process downloaded ELF content, wrote it to a memfd-backed descriptor, and executed it directly - with no file ever appearing on disk.

Timestamp (UTC)HostEventDetailIOC/Why Suspicious?
2022-08-23 14:00:05lnx-app-node15auditd EXECVEpython3 -c "import urllib.request,os,ctypes; ..." launched via a modified cron entryDelivery IOC: an obfuscated inline Python one-liner run from cron, rather than a scheduled application script.
2022-08-23 14:00:06lnx-app-node15NetworkHTTP GET to hxxp://194.61.55.90/agent.elf, 1.8 MB responseConfirms the Python process fetched a binary payload over the network immediately before the memfd sequence.
2022-08-23 14:00:07lnx-app-node15auditd SYSCALLmemfd_create("", MFD_CLOEXEC) returns fd=3, followed by write(3, ...) of 1.8 MBFileless IOC: binary content written into an anonymous, memory-only file descriptor rather than to any disk path.
2022-08-23 14:00:08lnx-app-node15auditd SYSCALLexecve("/proc/self/fd/3", ...) - new process PID 22190 spawnedExecution-via-FD IOC: the ELF is executed by referencing its memory file descriptor directly, never touching the filesystem.
2022-08-23 14:00:09lnx-app-node15(process check)/proc/22190/exe resolves to memfd:agent (deleted); no matching file exists anywhere on diskConfirmed Fileless: this is the definitive artifact of memfd-based execution - a running, fully-functional process with zero on-disk footprint for file-based AV/EDR to scan.

Validation:

Step 4: Recommendations & Next Steps

Hypothesis confirmed - an attacker used a tampered cron entry to download an ELF payload and execute it entirely in memory via memfd_create, leaving no file on disk for traditional antivirus scanning to detect!