Kernel Modules and Extensions
Adversaries may modify the kernel to automatically execute programs on system boot. Loadable Kernel Modules (LKMs) are pieces of code that can be loaded and unloaded into the kernel upon demand, extending kernel functionality without reboot. When used maliciously, LKMs can be a type of kernel-mode rootkit running at Ring 0 with the highest operating system privilege. Common features of LKM-based rootkits include hiding processes, files, and network activity, log tampering, providing backdoors, and enabling root access. On macOS, kernel extensions (kexts) provide similar functionality but are deprecated since Catalina 10.15 in favor of System Extensions. Known malware using this technique includes Drovorub, Skidmap, REPTILE, Diamorphine, and Phalanx.
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("insmod", "modprobe", "kextload", "kextutil")
or (FileName =~ "modinfo" and ProcessCommandLine has_any (".ko", "rootkit", "diamorphine", "reptile"))
| extend ModulePath = extract(@"([\w/\-\.]+\.ko)", 1, ProcessCommandLine)
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine, ModulePath,
InitiatingProcessFileName, InitiatingProcessCommandLine
| sort by Timestamp desc Data Sources
Required Tables
False Positives
- System boot loading standard kernel modules (e.g., network drivers, filesystem modules, USB drivers)
- Package manager (apt, yum, dnf) installing kernel module packages that trigger modprobe
- VirtualBox, VMware, or Docker installing their kernel modules (vboxdrv, vmmon, overlay)
- DKMS (Dynamic Kernel Module Support) rebuilding modules after kernel updates
References (7)
- https://attack.mitre.org/techniques/T1547/006/
- https://www.tldp.org/LDP/lkmpg/2.4/lkmpg.pdf
- https://github.com/f0rb1dd3n/Reptile
- https://github.com/m0nad/Diamorphine
- https://www.crowdstrike.com/blog/http-iframe-injecting-linux-rootkit/
- https://developer.apple.com/support/kernel-extensions/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1547.006/T1547.006.md
Unlock Pro Content
Get the full detection package for T1547.006 including response playbook, investigation guide, and atomic red team tests.