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/05/21"
  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"
 67
 68query = '''
 69process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "executed", "process_started")
 70 and process.name == "kexec" and process.args in ("--exec", "-e", "--load", "-l", "--unload", "-u")
 71'''
 72
 73
 74[[rule.threat]]
 75framework = "MITRE ATT&CK"
 76[[rule.threat.technique]]
 77id = "T1611"
 78name = "Escape to Host"
 79reference = "https://attack.mitre.org/techniques/T1611/"
 80
 81
 82[rule.threat.tactic]
 83id = "TA0004"
 84name = "Privilege Escalation"
 85reference = "https://attack.mitre.org/tactics/TA0004/"
 86[[rule.threat]]
 87framework = "MITRE ATT&CK"
 88[[rule.threat.technique]]
 89id = "T1547"
 90name = "Boot or Logon Autostart Execution"
 91reference = "https://attack.mitre.org/techniques/T1547/"
 92[[rule.threat.technique.subtechnique]]
 93id = "T1547.006"
 94name = "Kernel Modules and Extensions"
 95reference = "https://attack.mitre.org/techniques/T1547/006/"
 96
 97
 98
 99[rule.threat.tactic]
100id = "TA0003"
101name = "Persistence"
102reference = "https://attack.mitre.org/tactics/TA0003/"
103[[rule.threat]]
104framework = "MITRE ATT&CK"
105[[rule.threat.technique]]
106id = "T1601"
107name = "Modify System Image"
108reference = "https://attack.mitre.org/techniques/T1601/"
109[[rule.threat.technique.subtechnique]]
110id = "T1601.001"
111name = "Patch System Image"
112reference = "https://attack.mitre.org/techniques/T1601/001/"
113
114
115
116[rule.threat.tactic]
117id = "TA0005"
118name = "Defense Evasion"
119reference = "https://attack.mitre.org/tactics/TA0005/"

References

Related rules

to-top