MITRE ATT&CKsub-technique
T1547.006 Kernel Modules and Extensions
- Domain
- enterprise
- Tactics
- Persistence, Privilege Escalation
- Platforms
- macOS, Linux
- Version
- 1.4
- Created
- 2020-01-24
Description
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.
When used maliciously, LKMs can be a type of kernel-mode Rootkit that run with the highest operating system privilege (Ring 0). 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.
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.
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.
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.
Related
Subtechnique of · MITRE ATT&CK (1)
- T1547 Boot or Logon Autostart Execution technique
Referenced by MITRE ATT&CK · mitigates (4)
Referenced by MITRE ATT&CK · uses (4)
Referenced by CAPEC · att&ck technique (1)
- CAPEC-552 Install Rootkit attack pattern
Referenced by Compliance · mitigates (22)
- CIS-10.1 Deploy and Maintain Anti-Malware Software CIS Safeguard v8.1
- CIS-10.7 Use Behavior-Based Anti-Malware Software CIS Safeguard v8.1
- CIS-13.7 Deploy a Host-Based Intrusion Prevention Solution CIS Safeguard v8.1
- CIS-6.8 Define and Maintain Role-Based Access Control CIS Safeguard v8.1
- NIST-AC-2 Account Management NIST 800-53 control
- NIST-AC-3 Access Enforcement NIST 800-53 control
- NIST-AC-5 Separation of Duties NIST 800-53 control
- NIST-AC-6 Least Privilege NIST 800-53 control
- NIST-CM-5 Access Restrictions for Change NIST 800-53 control
- NIST-CM-6 Configuration Settings NIST 800-53 control
- NIST-CM-7 Least Functionality NIST 800-53 control
- NIST-IA-2 Identification and Authentication (Organizational Users) NIST 800-53 control
- NIST-IA-4 Identifier Management NIST 800-53 control
- NIST-IA-8 Identification and Authentication (Non-organizational Users) NIST 800-53 control
- NIST-RA-5 Vulnerability Monitoring and Scanning NIST 800-53 control
- NIST-SI-10 Information Input Validation NIST 800-53 control
- NIST-SI-14 Non-persistence NIST 800-53 control
- NIST-SI-16 Memory Protection NIST 800-53 control
- NIST-SI-2 Flaw Remediation NIST 800-53 control
- NIST-SI-3 Malicious Code Protection NIST 800-53 control
- NIST-SI-4 System Monitoring NIST 800-53 control
- NIST-SI-7 Software, Firmware, and Information Integrity NIST 800-53 control
References
- https://developer.apple.com/business/documentation/Configuration-Profile-Reference.pdf Apple Developer Configuration Profile
- https://developer.apple.com/support/kernel-extensions/ Apple Kernel Extension Deprecation
- https://support.apple.com/guide/deployment/system-and-kernel-extensions-in-macos-depa5fb8376f/web System and kernel extensions in macOS
- https://github.com/f0rb1dd3n/Reptile GitHub Reptile
- https://volatility-labs.blogspot.com/2012/10/phalanx-2-revealed-using-volatility-to.html Volatility Phalanx2
- https://www.megasecurity.org/papers/Rootkits.pdf iDefense Rootkit Overview
- https://tldp.org/HOWTO/Module-HOWTO/x197.html Linux Loadable Kernel Module Insert and Remove LKMs
- https://www.crowdstrike.com/blog/http-iframe-injecting-linux-rootkit/ CrowdStrike Linux Rootkit
- https://github.com/m0nad/Diamorphine GitHub Diamorphine
- https://securelist.com/the-ventir-trojan-assemble-your-macos-spy/67267/ Securelist Ventir
- https://pikeralpha.wordpress.com/2017/08/29/user-approved-kernel-extension-loading/ User Approved Kernel Extension Pike’s
- https://tldp.org/LDP/lkmpg/2.4/html/x437.html Linux Kernel Module Programming Guide
- https://www.tldp.org/LDP/lkmpg/2.4/lkmpg.pdf Linux Kernel Programming
- https://blog.trendmicro.com/trendlabs-security-intelligence/skidmap-linux-malware-uses-rootkit-capabilities-to-hide-cryptocurrency-mining-payload/ Trend Micro Skidmap
- https://richard-purves.com/2017/11/09/mdm-and-the-kextpocalypse-2/ Purves Kextpocalypse 2
- https://www.virusbulletin.com/uploads/pdf/conference/vb2014/VB2014-Wardle.pdf RSAC 2015 San Francisco Patrick Wardle
- https://objective-see.org/blog/blog_0x21.html Synack Secure Kernel Extension Broken
- https://en.wikipedia.org/wiki/Loadable_kernel_module#Linux Wikipedia Loadable Kernel Module