Attempt to Clear Kernel Ring Buffer via dmesg
The rule detects attempts to clear the kernel ring buffer on Linux systems using the `dmesg` command with options like `-c`, `-C`, `--clear`, or `--read-clear` to evade detection.
This detection rule identifies attempts to clear the kernel ring buffer on Linux systems, a tactic often employed by attackers to evade detection after installing malicious Linux Kernel Modules (LKMs). The kernel ring buffer stores system messages, including those related to LKM installation and activity. By clearing this buffer using the dmesg command with specific arguments, attackers aim to remove traces of their activities, hindering forensic investigations and incident response. This technique is often associated with intrusions leveraging kernel-level rootkits to maintain persistence on compromised hosts. The rule monitors for the execution of the dmesg command with arguments used to clear the buffer, providing a high-fidelity signal of potential defense evasion.
Attack Chain
- The attacker gains initial access to the Linux system, potentially through exploiting a vulnerability or using compromised credentials.
- The attacker escalates privileges to root, if necessary, to perform kernel-level operations.
- The attacker installs a malicious Linux Kernel Module (LKM) to establish persistence or perform other malicious activities.
- The attacker executes the
dmesgcommand with the-c,-C,--clear, or--read-cleararguments. This command clears the kernel ring buffer, removing recent system messages. - The system logs record the execution of the
dmesgcommand. - The attacker may further tamper with other logs or system configurations to eliminate additional evidence of their presence.
- The attacker maintains persistent access through the installed LKM, potentially performing data exfiltration or other malicious activities.
- The attacker’s objective is to maintain a hidden presence and continue malicious activities without detection.
Impact
Successful clearing of the kernel ring buffer can significantly hinder incident response efforts. It can obscure the installation and activities of malicious LKMs, making it difficult to identify the root cause of a compromise and assess the extent of the damage. This evasion tactic allows attackers to maintain a persistent presence on the compromised system, potentially leading to long-term data theft, system disruption, or other malicious outcomes.
Recommendation
- Deploy the provided Sigma rules to your SIEM to detect attempts to clear the kernel ring buffer via
dmesg. - Investigate any alerts triggered by the Sigma rules, focusing on the user account and processes involved.
- Monitor for the installation and modification of Linux kernel modules (LKMs) to detect unauthorized kernel-level changes.
- Review and update access controls and permissions to limit the ability to execute commands like
dmesg -cto authorized users only. - Enable Elastic Defend, Elastic Endgame, Auditd Manager, Crowdstrike, and SentinelOne data ingestion to enable the detection rule from the source advisory.
Detection coverage 2
Detect Kernel Ring Buffer Cleared via dmesg
highDetects clearing the kernel ring buffer using the `dmesg` command with specific arguments.
Detect Kernel Ring Buffer Cleared via dmesg - alternative path
highDetects clearing the kernel ring buffer using the `dmesg` command with specific arguments in /bin
Detection queries are available on the platform. Get full rules →