Boot or Logon Autostart Execution: Kernel Modules and Extensions
- ID
- T1547.006
- Tactics
- TA0003 Persistence, TA0004 Privilege Escalation
- Sub-technique of
- T1547 Boot or Logon Autostart Execution
- Platforms
- macOS, Linux
- Data sources
- Command Execution, File Creation, File Modification, Process Creation, Kernel Module Load
- Source
- attack.mitre.org
- MITRE last modified
- 25 Oct 2025
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.[10]
When used maliciously, LKMs can be a type of kernel-mode Rootkit that run with the highest operating system privilege (Ring 0).[11] Common features of LKM based rootkits include: hiding itself, selective hiding of files, processes and network activity, as well as log tampering, providing authenticated backdoors, and enabling root access to non-privileged users.[12]
Kernel extensions, also called kext, are used in macOS to load functionality onto a system similar to LKMs for Linux. Since the kernel is responsible for enforcing security and the kernel extensions run as apart of the kernel, kexts are not governed by macOS security policies. Kexts are loaded and unloaded through kextload and kextunload commands. Kexts need to be signed with a developer ID that is granted privileges by Apple allowing it to sign Kernel extensions. Developers without these privileges may still sign kexts but they will not load unless SIP is disabled. If SIP is enabled, the kext signature is verified before being added to the AuxKC.[13]
Since macOS Catalina 10.15, kernel extensions have been deprecated in favor of System Extensions. However, kexts are still allowed as "Legacy System Extensions" since there is no System Extension for Kernel Programming Interfaces.[14]
Adversaries can use LKMs and kexts to conduct Persistence and/or Privilege Escalation on a system. Examples have been found in the wild, and there are some relevant open source projects as well.[15][16][17][18][19][20][21][22]
Detection
- DET0450 Detection Strategy for Kernel Modules and Extensions Autostart Execution
Data components: Command Execution, File Creation, File Modification, Process Creation, Kernel Module Load
Mitigations (4)
- M1018 User Account Management
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.[1][2]- M1026 Privileged Account Management
Limit access to the root account and prevent users from loading kernel modules and extensions through proper privilege separation and limiting Privilege Escalation opportunities.
- M1038 Execution Prevention
Application control and software restriction tools, such as SELinux, KSPP, grsecurity MODHARDEN, and Linux kernel tuning can aid in restricting kernel module loading.[3][4][5][6][7]
- M1049 Antivirus/Antimalware
Common tools for detecting Linux rootkits include: rkhunter [8], chrootkit [9], although rootkits may be designed to evade certain detection tools.
Software (3)
References
- Apple TN2459 Kernel Extensions
- MDMProfileConfigMacOS
- Kernel.org Restrict Kernel Module
- Wikibooks Grsecurity
- Kernel Self Protection Project
- Increasing Linux kernel integrity
- LKM loading kernel restrictions
- SourceForge rkhunter
- Chkrootkit Main
- Linux Kernel Programming
- Linux Kernel Module Programming Guide
- iDefense Rootkit Overview
- System and kernel extensions in macOS
- Apple Kernel Extension Deprecation
- Volatility Phalanx2
- CrowdStrike Linux Rootkit
- GitHub Reptile
- GitHub Diamorphine
- RSAC 2015 San Francisco Patrick Wardle
- Synack Secure Kernel Extension Broken
- Securelist Ventir
- Trend Micro Skidmap
