Detection of Linux Kernel Module Enumeration
Detection of the kmod process enumerating kernel modules, a common discovery step used by attackers to profile systems before loading malicious rootkits or kernel-level persistence.
The kmod utility is a standard component in Linux systems used for managing kernel modules. Threat actors, particularly those deploying sophisticated malware like the XorDDos botnet or various Linux rootkits, often leverage kmod to enumerate currently loaded modules. This discovery activity is a critical precursor to identifying gaps in security controls or verifying the presence of competing malware before the attacker attempts to inject their own unauthorized kernel modules using insmod. While system administrators frequently perform this enumeration during routine maintenance or troubleshooting, its occurrence in non-standard execution contexts - or when paired with subsequent module loading commands - serves as a high-fidelity signal of potential system compromise and rootkit installation attempts.
Attack Chain
- Initial access is established via an exploit or stolen credentials.
- Attacker executes reconnaissance commands to determine the current system state, including kernel version and loaded drivers.
- Attacker executes 'kmod lsmod' or 'kmod list' to identify active kernel modules and hook points.
- Attacker identifies a target to replace or inject a malicious module for persistence.
- Attacker compiles or retrieves a malicious kernel module (e.g., a rootkit).
- Attacker uses 'insmod' or 'modprobe' to load the malicious module into the kernel.
- Attacker uses the loaded module to hide files, processes, or network connections (rootkit functionality).
Impact
Successful exploitation allows for the installation of kernel-level rootkits, providing attackers with deep, persistent control over the operating system. This access can facilitate complete system subversion, bypass of EDR/security agents, data exfiltration, and long-term concealment of malicious activities within the kernel, making detection and removal extremely difficult.
Recommendation
- Deploy the provided Sigma rule to detect kmod module enumeration activity within your SIEM.
- Monitor for suspicious parent-child process relationships where kmod is spawned by web servers, shells, or non-administrative service accounts.
- Establish a baseline for normal module management activity to reduce false positives from automated configuration scripts.
- Investigate any instances of kmod enumeration followed immediately by calls to 'insmod' or 'modprobe' for unknown or unsigned files.
Immediate actions
Deploy the Sigma rule to detect kmod enumeration
Threat Hunt
Search for kmod executions followed by insmod or modprobe
Data: Process creation logs
Detection coverage 1
Detect Linux Kernel Module Enumeration via kmod
mediumDetects the use of the kmod process with arguments indicating module listing, which may be a precursor to kernel module injection.
Detection queries are available on the platform. Get full rules →