T1547.006 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. 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.(Citation: Linux Kernel Programming) 

When used maliciously, LKMs can be a type of kernel-mode Rootkit that run with the highest operating system privilege (Ring 0).(Citation: Linux Kernel Module Programming Guide) 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.(Citation: iDefense Rootkit Overview)

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 <code>kextload</code> and <code>kextunload</code> 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.(Citation: System and kernel extensions in macOS)

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.(Citation: Apple Kernel Extension Deprecation)

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.(Citation: Volatility Phalanx2)(Citation: CrowdStrike Linux Rootkit)(Citation: GitHub Reptile)(Citation: GitHub Diamorphine)(Citation: RSAC 2015 San Francisco Patrick Wardle)(Citation: Synack Secure Kernel Extension Broken)(Citation: Securelist Ventir)(Citation: Trend Micro Skidmap)

View in MITRE ATT&CK®

CRI Profile Mappings

Capability ID Capability Description Mapping Type ATT&CK ID ATT&CK Name Notes
PR.IR-01.05 Remote access protection Mitigates T1547.006 Kernel Modules and Extensions
Comments
This diagnostic statement implements security controls and restrictions for remote user access to systems. Remote user access control involves managing and securing how users remotely access systems, such as through encrypted connections and account use policies, which help prevent adversary access.
References
    PR.PS-01.01 Configuration baselines Mitigates T1547.006 Kernel Modules and Extensions
    Comments
    This diagnostic statement provides for securely configuring production systems. This includes hardening default configurations and making security-focused setting adjustments to reduce the attack surface, enforce best practices, and protect sensitive data thereby mitigating adversary exploitation.
    References
      PR.AA-05.02 Privileged system access Mitigates T1547.006 Kernel Modules and Extensions
      Comments
      This diagnostic statement protects against Kernel Modules and Extensions through the use of privileged account management and the use of multi-factor authentication.
      References
        PR.PS-05.01 Malware prevention Mitigates T1547.006 Kernel Modules and Extensions
        Comments
        Antivirus/Antimalware software should be utilized to detect and quarantine suspicious files that adversaries have made difficult to discover by encrypting, encoding or obfuscating its contents on the system.
        References
          PR.AA-01.02 Physical and logical access Mitigates T1547.006 Kernel Modules and Extensions
          Comments
          This diagnostic statement describes how the organization ensures users are identified and authenticated before accessing systems, applications, and hardware, with logical access controls permitting access only to authorized individuals with legitimate business needs. Logical access controls in relation to systems can refer to the use of MFA, user account management, and other role-based access control mechanisms to enforce policies for authentication and authorization of user accounts.
          References
            PR.IR-01.06 Production environment segregation Mitigates T1547.006 Kernel Modules and Extensions
            Comments
            This diagnostic statement provides protections for production environments. Measures such as network segmentation and access control reduce the attack surface, restrict movement by adversaries, and protect critical assets and data from compromise.
            References
              PR.IR-01.08 End-user device access Mitigates T1547.006 Kernel Modules and Extensions
              Comments
              This diagnostic statement implements technical controls (e.g., VPN, antivirus software) to address the risks of end-user personal computing devices accessing the organization’s network and resources.
              References
                PR.AA-01.01 Identity and credential management Mitigates T1547.006 Kernel Modules and Extensions
                Comments
                This diagnostic statement protects against Kernel Modules and Extensions through the use of hardened access control policies, secure defaults, password complexity requirements, multifactor authentication requirements, and removal of terminated accounts.
                References
                  PR.PS-01.08 End-user device protection Mitigates T1547.006 Kernel Modules and Extensions
                  Comments
                  This diagnostic statement protects against Kernel Modules and Extensions through the use of limiting access to resources to only authorized devices, management of personal computing devices, network intrusion prevention, and the use of antimalware.
                  References

                    NIST 800-53 Mappings

                    Capability ID Capability Description Mapping Type ATT&CK ID ATT&CK Name Notes
                    CM-06 Configuration Settings mitigates T1547.006 Kernel Modules and Extensions
                    CM-05 Access Restrictions for Change mitigates T1547.006 Kernel Modules and Extensions
                    IA-08 Identification and Authentication (Non-Organizational Users) mitigates T1547.006 Kernel Modules and Extensions
                    SI-14 Non-persistence mitigates T1547.006 Kernel Modules and Extensions
                    IA-04 Identifier Management mitigates T1547.006 Kernel Modules and Extensions
                    SI-16 Memory Protection mitigates T1547.006 Kernel Modules and Extensions
                    SI-02 Flaw Remediation mitigates T1547.006 Kernel Modules and Extensions
                    RA-05 Vulnerability Monitoring and Scanning mitigates T1547.006 Kernel Modules and Extensions
                    SI-10 Information Input Validation mitigates T1547.006 Kernel Modules and Extensions
                    SI-03 Malicious Code Protection mitigates T1547.006 Kernel Modules and Extensions
                    SI-07 Software, Firmware, and Information Integrity mitigates T1547.006 Kernel Modules and Extensions
                    IA-02 Identification and Authentication (Organizational Users) mitigates T1547.006 Kernel Modules and Extensions
                    CM-07 Least Functionality mitigates T1547.006 Kernel Modules and Extensions
                    SI-04 System Monitoring mitigates T1547.006 Kernel Modules and Extensions
                    AC-02 Account Management mitigates T1547.006 Kernel Modules and Extensions
                    AC-03 Access Enforcement mitigates T1547.006 Kernel Modules and Extensions
                    AC-05 Separation of Duties mitigates T1547.006 Kernel Modules and Extensions
                    AC-06 Least Privilege mitigates T1547.006 Kernel Modules and Extensions

                    VERIS Mappings

                    Capability ID Capability Description Mapping Type ATT&CK ID ATT&CK Name Notes
                    action.malware.variety.Capture app data Capture data from application or system process related-to T1547.006 Kernel Modules and Extensions
                    attribute.integrity.variety.Modify configuration Modified configuration or services related-to T1547.006 Kernel Modules and Extensions

                    Azure Mappings

                    Capability ID Capability Description Mapping Type ATT&CK ID ATT&CK Name Notes
                    file_integrity_monitoring Microsoft Defender for Cloud: File Integrity Monitoring technique_scores T1547.006 Kernel Modules and Extensions
                    Comments
                    This control may detect changes to the Windows registry or files that enable Boot or Logon Autostart Execution. This control at worst scans for changes on an hourly basis.
                    References
                    alerts_for_linux_machines Alerts for Linux Machines technique_scores T1547.006 Kernel Modules and Extensions
                    Comments
                    This control may alert on a suspicious shared object file being loaded as a kernel module. No documentation is provided on the logic but kernel module loading is a relatively rare event and can only be done with a small set of commands.
                    References