ICMP-Ghost: A Pure x64 Assembly Fileless C2 Architecture
In the field of cybersecurity research, optimizing system integrity and minimizing the operational footprint are crucial for accurate environment analysis. Today, we are exploring a project focused on volatile memory execution and non-traditional communication protocols: ICMP-Ghost. This project serves as a technical proof-of-concept for building a minimalist remote management interface using low-level Assembly methods to ensure high efficiency and low system impact.
🛠 Why Pure x64 Assembly & Syscalls?
Most modern malware is written in C or C++, relying heavily on libc and other external dependencies. However, in ICMP-Ghost, the rule is simple: No Libc, No Dependencies. By communicating directly with the Linux Kernel via system calls (syscalls), we achieve:
Microscopic Footprint: The compiled binary is only a few kilobytes.
Analysis Resistance: Static analysis tools struggle because they cannot find standard library function signatures.
Absolute Control: Every register, every packet, and every memory address is under our direct management.
👻 The "Fileless" Core: memfd_create Magic
The primary challenge in low-impact system operations is writing a file to the disk—this is exactly where EDRs and AVs hunt. ICMP-Ghost solves this by using the memfd_create system call to store command outputs.
What is
memfd_create? It creates an anonymous file that exists only in RAM. It has no presence on the physical disk. Since it isn't listed bylsand disappears the moment the process ends, it is practically invisible to traditional forensic analysis.
🕵️♂️ Technical Implementation Mechanisms: Daemonization & ICMP Tunneling
1. Daemonization via setsid
The moment the agent starts, it detaches itself from the terminal (setsid). It becomes a "background ghost." Even if the user closes the terminal window, the agent continues to run silently with root privileges.
2. ICMP Tunneling
Instead of noisy TCP ports like 4444, we utilize the ICMP (Ping) protocol. To network monitoring tools, this traffic looks like legitimate Echo Requests. However, hidden within those packets are our encrypted commands and exfiltrated data.
🏗 Execution Flow (The Ghost Logic)
execve, but the stdout is hijacked using dup2 and redirected to our anonymous file in RAM.🚀 Roadmap & Future Enhancements
[kworker] to blend into system threads.ptrace checks to detect debuggers and VMs.🛡️ Defense Analysis: Detection and Mitigation Strategies
1. Network-Level Detection (ICMP Anomalies)
memfd_create, traditional disk-based scanning will fail. Security tools should monitor:lsof or inspecting /proc/[pid]/fd/, analysts can look for file descriptors linked to memfd:, which indicates a process running entirely from RAM.socket(AF_INET, SOCK_RAW, IPPROTO_ICMP) calls.3. Behavioral Analysis (Process Lineage)
setsid) creates a specific behavioral footprint:PPID 1 (init/systemd) but are not standard system services should be treated as suspicious.fork -> setsid -> dup2 -> execve involving unusual file descriptors, which is a hallmark of this type of remote interface.