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

References

Related rules

to-top