During Operation CuckooBees, attackers used a signed kernel rootkit to establish additional persistence.1
Kernel Modules and Extensions T1547.006
- Tactics
- Persistence, Privilege Escalation
- Platforms
- macOS, Linux
- Version
- 1.4
- Created
- 24 January 2020
- Last modified
- 24 October 2025
- Contributors
- Wayne Silva, F-Secure Countercept; Anastasios Pingios; Jeremy Galloway; Red Canary; Eric Kaiser @ideologysec
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. They extend the functionality of the kernel without the need to reboot the system. For example, one type of module is the device driver, which allows the kernel to access hardware connected to the system.[1]
Kernel Modules and Extensions MITRE reference T1547.006
1 campaign has been recorded using this technique. Listed newest first; dates are year-granularity and attribution is MITRE’s.
All 1 campaigns for this technique
3 software entries are documented implementing this technique. MITRE files each as a tool or as malware; newest first, then by how many groups carry them.
The REPTILE rootkit is implemented as a loadable kernel module (LKM).1
Can use kernel modules to establish persistence.1
Has the ability to install several loadable kernel modules (LKMs) on infected machines.1
All 3 software entries for this technique
Offense vs defense T1547.006
Is defensive coverage keeping up with adversary use? Eight counts, each ranked against all 697 ATT&CK techniques. Attack sits left, defense right, so a shape leaning left means adversaries are better documented here than defenders are equipped. Hover any spoke for its percentile and the share of techniques that have more. The timeline below shows when each side arrived.
How it got here
Adversary activity (campaign spans) over cumulative rule output. Each source is plotted independently from zero, so neither line includes the other. Campaign dates are year-granularity.
Kernel Modules and Extensions detection strategy DET0450
MITRE names one behaviour worth catching for this technique and breaks it into 2 analytics, one per platform. Each carries the log sources it needs and the fields you tune per environment.
Detection Strategy for Kernel Modules and Extensions Autostart Execution
AN1243 · Linux
Monitor kernel module load/unload activity via modprobe, insmod, rmmod, or direct manipulation of /lib/modules. Correlate with installation of kernel headers, compilation commands, or downloads of .ko files. Detect anomalies in unsigned module loading or repeated module load attempts under non-root users.
Log sources
The data this analytic draws on. You do not need every component — each one you already collect covers part of it. Each links to its ATT&CK record.
| Data component | Name | Channel |
|---|---|---|
| File CreationDC0039 | auditd:SYSCALL | Access or modification to /lib/modules or creation of .ko files |
| File ModificationDC0061 | linux:osquery | New or modified kernel object files (.ko) within /lib/modules directory |
| Command ExecutionDC0064 | auditd:SYSCALL | Execution of insmod, modprobe, or rmmod commands by non-standard users or outside expected timeframes |
Tunable fields
MITRE calls these the analytic’s mutable elements: the thresholds and filters you set for your own environment.
| Field | What you tune |
|---|---|
| UserContext | Scope detection to non-root or unexpected users performing module-related activity |
| TimeWindow | Limit alerts to module activity outside approved change windows |
| FilePathRegex | Adjust regex pattern for directories to monitor depending on kernel version or distro |
AN1244 · macOS
Detect user-initiated kextload commands or modifications to /Library/Extensions. Correlate with changes to KextPolicy database or unauthorized developer signing identities. Alert on attempts to disable SIP or load legacy extensions from unsigned sources.
Log sources
The data this analytic draws on. You do not need every component — each one you already collect covers part of it. Each links to its ATT&CK record.
| Data component | Name | Channel |
|---|---|---|
| Kernel Module LoadDC0031 | macos:osquery | New kext entries not signed by Apple or outside standard identifier prefix |
| Process CreationDC0032 | macos:osquery | Processes executing kextload, spctl, or modifying kernel extension directories |
| File ModificationDC0061 | macos:osquery | Modifications to /var/db/SystemPolicyConfiguration/KextPolicy or kext_policy table |
| Command ExecutionDC0064 | macos:unifiedlog | kextload execution from Terminal or suspicious paths |
Tunable fields
MITRE calls these the analytic’s mutable elements: the thresholds and filters you set for your own environment.
| Field | What you tune |
|---|---|
| DeveloperIDAllowlist | Approved developer IDs whose kexts should not trigger alerts |
| KextLoadTimeWindow | Threshold for detecting kext loads outside standard install/update operations |
| SignatureCheckFlag | Flag to enforce strict signing checks depending on SIP status |
Common tools for detecting Linux rootkits include: rkhunter , chrootkit , although rootkits may be designed to evade certain detection tools.
Application control and software restriction tools, such as SELinux, KSPP, grsecurity MODHARDEN, and Linux kernel tuning can aid in restricting kernel module loading.
Limit access to the root account and prevent users from loading kernel modules and extensions through proper privilege separation and limiting Privilege Escalation opportunities.
Use MDM to disable user's ability to install or approve kernel extensions, and ensure all approved kernel extensions are in alignment with policies specified in com.apple.syspolicy.kernel-extension-policy.
| # | Test | Platform | Executor | Elevation | Prereqs | Cleanup | Ref | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 01 | Linux - Load Kernel Module via insmod | linux | bash | Required | 1 | Yes | ||||||||||||||||||||||
This test uses the insmod command to load a kernel module for Linux. Input arguments
Attack command sudo insmod #{module_path}
Cleanup command sudo rmmod #{module_name}
[ -f #{temp_folder}/safe_to_delete ] && rm -rf #{temp_folder}
Prerequisite The kernel module must exist on disk at specified location Check if [ -f #{module_path} ]; then exit 0; else exit 1; fi;
Satisfy if [ ! -d #{temp_folder} ]; then mkdir #{temp_folder}; touch #{temp_folder}/safe_to_delete; fi;
cp #{module_source_path}/* #{temp_folder}/
cd #{temp_folder}; make
if [ ! -f #{module_path} ]; then mv #{temp_folder}/#{module_name}.ko #{module_path}; fi;
GUID1774188e-38ff-453e-9f09-300997a9df97 | ||||||||||||||||||||||||||||
| 02 | MacOS - Load Kernel Module via kextload and kmutil | macos | bash | Required | 1 | — | ||||||||||||||||||||||
This test uses the kextload and kmutil commands to load and unload a MacOS kernel module. Input arguments
Attack command set -x
sudo kextload #{module_path}
kextstat 2>/dev/null | grep SoftRAID
sudo kextunload #{module_path}
sudo kmutil load -p #{module_path}
kextstat 2>/dev/null | grep SoftRAID
sudo kmutil unload -p #{module_path}
Prerequisite The kernel module must exist on disk at specified location Check if [ -d #{module_path} ] ; then exit 0; else exit 1 ; fi
Satisfy exit 1 GUID119c001f-e390-4fa7-a376-98aa625b9e59 | ||||||||||||||||||||||||||||
| 03 | MacOS - Load Kernel Module via KextManagerLoadKextWithURL() | macos | bash | Required | 1 | Yes | ||||||||||||||||||||||
This test uses the IOKit API to load a kernel module for macOS. Harcoded to use SoftRAID kext Input arguments
Attack command sudo #{exe_path}
kextstat 2>/dev/null | grep SoftRAID
sudo kextunload /Library/Extensions/SoftRAID.kext
Cleanup command rm -f #{exe_path}
Prerequisite The kernel module must exist on disk at specified location Check if [ -f "#{exe_path}" ]; then exit 0 ; else exit 1; fi
Satisfy cc -o #{exe_path} #{src_path} -framework IOKit -framework Foundation
GUID3b72af97-a878-485d-8374-abffcc1fed95 | ||||||||||||||||||||||||||||
| 04 | Snake Malware Kernel Driver Comadmin | windows | PowerShell | Required | — | Yes | ||||||||||||||||||||||
The following Atomic Test will write an file, comadmin.dat, to disk. From the report, Snake's installer drops the kernel driver and a custom DLL which is used to load the driver into a single AES encrypted file on disk. Typically, this file is named “comadmin.dat” and is stored in the %windows%\system32\Com directory. This Atomic Test will write a hardcoded named file to disk in the com directory named comadmin.dat. Snake Malware - CISA Attack command $examplePath = Join-Path $env:windir "system32\Com"; if (-not (Test-Path $examplePath)) { New-Item -ItemType Directory -Path $examplePath | Out-Null }; $exampleName = "comadmin.dat"; $exampleFullPath = Join-Path $examplePath $exampleName; $randomBytes = New-Object Byte[] 0x1000; (New-Object Random).NextBytes($randomBytes); [System.IO.File]::WriteAllBytes($exampleFullPath, $randomBytes)
Cleanup command $examplePath = Join-Path $env:windir "system32\Com"; $exampleName = "comadmin.dat"; $exampleFullPath = Join-Path $examplePath $exampleName; if (Test-Path $exampleFullPath) { Remove-Item $exampleFullPath -Force }
GUID8efd9345-c94d-4e00-a6b6-8b0315e9a01f | ||||||||||||||||||||||||||||
Tests from Atomic Red Team (MIT licence) · technique definition