Kernel Load or Unload via Kexec Detected
This detection rule identifies the usage of kexec, helping to uncover unauthorized kernel replacements and potential compromise of the system's integrity. Kexec is a Linux feature that enables the loading and execution of a different kernel without going through the typical boot process. Malicious actors can abuse kexec to bypass security measures, escalate privileges, establish persistence or hide their activities by loading a malicious kernel, enabling them to tamper with the system's trusted state, allowing e.g. a VM Escape.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2023/06/09"
3integration = ["endpoint", "auditd_manager"]
4maturity = "production"
5updated_date = "2024/10/17"
6
7[rule]
8author = ["Elastic"]
9description = """
10This detection rule identifies the usage of kexec, helping to uncover unauthorized kernel replacements and potential
11compromise of the system's integrity. Kexec is a Linux feature that enables the loading and execution of a different
12kernel without going through the typical boot process. Malicious actors can abuse kexec to bypass security measures,
13escalate privileges, establish persistence or hide their activities by loading a malicious kernel, enabling them to
14tamper with the system's trusted state, allowing e.g. a VM Escape.
15"""
16from = "now-9m"
17index = ["logs-endpoint.events.*", "endgame-*", "auditbeat-*", "logs-auditd_manager.auditd-*"]
18language = "eql"
19license = "Elastic License v2"
20name = "Kernel Load or Unload via Kexec Detected"
21references = [
22 "https://www.crowdstrike.com/blog/venom-vulnerability-details/",
23 "https://www.makeuseof.com/what-is-venom-vulnerability/",
24 "https://madaidans-insecurities.github.io/guides/linux-hardening.html",
25]
26risk_score = 47
27rule_id = "4d4c35f4-414e-4d0c-bb7e-6db7c80a6957"
28setup = """## Setup
29
30This rule requires data coming in from Elastic Defend.
31
32### Elastic Defend Integration Setup
33Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
34
35#### Prerequisite Requirements:
36- Fleet is required for Elastic Defend.
37- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
38
39#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
40- Go to the Kibana home page and click "Add integrations".
41- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
42- Click "Add Elastic Defend".
43- Configure the integration name and optionally add a description.
44- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
45- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
46- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
47- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
48For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
49- Click "Save and Continue".
50- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
51For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
52"""
53severity = "medium"
54tags = [
55 "Domain: Endpoint",
56 "OS: Linux",
57 "Use Case: Threat Detection",
58 "Tactic: Persistence",
59 "Tactic: Privilege Escalation",
60 "Tactic: Defense Evasion",
61 "Data Source: Elastic Defend",
62 "Data Source: Elastic Endgame",
63 "Data Source: Auditd Manager",
64]
65timestamp_override = "event.ingested"
66type = "eql"
67query = '''
68process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "executed", "process_started")
69 and process.name == "kexec" and process.args in ("--exec", "-e", "--load", "-l", "--unload", "-u") and not
70 process.parent.name in ("kdumpctl", "unload.sh")
71'''
72
73[[rule.threat]]
74framework = "MITRE ATT&CK"
75
76[[rule.threat.technique]]
77id = "T1611"
78name = "Escape to Host"
79reference = "https://attack.mitre.org/techniques/T1611/"
80
81[rule.threat.tactic]
82id = "TA0004"
83name = "Privilege Escalation"
84reference = "https://attack.mitre.org/tactics/TA0004/"
85
86[[rule.threat]]
87framework = "MITRE ATT&CK"
88
89[[rule.threat.technique]]
90id = "T1547"
91name = "Boot or Logon Autostart Execution"
92reference = "https://attack.mitre.org/techniques/T1547/"
93
94[[rule.threat.technique.subtechnique]]
95id = "T1547.006"
96name = "Kernel Modules and Extensions"
97reference = "https://attack.mitre.org/techniques/T1547/006/"
98
99[rule.threat.tactic]
100id = "TA0003"
101name = "Persistence"
102reference = "https://attack.mitre.org/tactics/TA0003/"
103
104[[rule.threat]]
105framework = "MITRE ATT&CK"
106
107[[rule.threat.technique]]
108id = "T1601"
109name = "Modify System Image"
110reference = "https://attack.mitre.org/techniques/T1601/"
111
112[[rule.threat.technique.subtechnique]]
113id = "T1601.001"
114name = "Patch System Image"
115reference = "https://attack.mitre.org/techniques/T1601/001/"
116
117[rule.threat.tactic]
118id = "TA0005"
119name = "Defense Evasion"
120reference = "https://attack.mitre.org/tactics/TA0005/"
References
Related rules
- Potential Hidden Process via Mount Hidepid
- Suspicious DLL Loaded for Persistence or Privilege Escalation
- Suspicious WerFault Child Process
- Potential Linux Backdoor User Account Creation
- Tampering of Shell Command-Line History