Kernel Module Removal

Kernel modules 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. This rule identifies attempts to remove a kernel module.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2020/04/24"
  3integration = ["endpoint"]
  4maturity = "production"
  5updated_date = "2024/17/21"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Kernel modules are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the
 11functionality of the kernel without the need to reboot the system. This rule identifies attempts to remove a kernel
 12module.
 13"""
 14false_positives = [
 15    """
 16    There is usually no reason to remove modules, but some buggy modules require it. These can be exempted by username.
 17    Note that some Linux distributions are not built to support the removal of modules at all.
 18    """,
 19]
 20from = "now-9m"
 21index = ["logs-endpoint.events.*", "endgame-*"]
 22language = "eql"
 23license = "Elastic License v2"
 24name = "Kernel Module Removal"
 25references = ["http://man7.org/linux/man-pages/man8/modprobe.8.html"]
 26risk_score = 47
 27rule_id = "cd66a5af-e34b-4bb0-8931-57d0a043f2ef"
 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: Defense Evasion",
 59    "Data Source: Elastic Endgame",
 60    "Data Source: Elastic Defend",
 61]
 62timestamp_override = "event.ingested"
 63type = "eql"
 64query = '''
 65process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event") and (
 66  process.name == "rmmod" or
 67  (process.name == "modprobe" and process.args in ("--remove", "-r"))
 68) and process.parent.name in ("sudo", "bash", "dash", "ash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")
 69'''
 70
 71[[rule.threat]]
 72framework = "MITRE ATT&CK"
 73
 74[[rule.threat.technique]]
 75id = "T1562"
 76name = "Impair Defenses"
 77reference = "https://attack.mitre.org/techniques/T1562/"
 78
 79[[rule.threat.technique.subtechnique]]
 80id = "T1562.001"
 81name = "Disable or Modify Tools"
 82reference = "https://attack.mitre.org/techniques/T1562/001/"
 83
 84[rule.threat.tactic]
 85id = "TA0005"
 86name = "Defense Evasion"
 87reference = "https://attack.mitre.org/tactics/TA0005/"
 88
 89[[rule.threat]]
 90framework = "MITRE ATT&CK"
 91
 92[[rule.threat.technique]]
 93id = "T1547"
 94name = "Boot or Logon Autostart Execution"
 95reference = "https://attack.mitre.org/techniques/T1547/"
 96
 97[[rule.threat.technique.subtechnique]]
 98id = "T1547.006"
 99name = "Kernel Modules and Extensions"
100reference = "https://attack.mitre.org/techniques/T1547/006/"
101
102[rule.threat.tactic]
103id = "TA0003"
104name = "Persistence"
105reference = "https://attack.mitre.org/tactics/TA0003/"

References

Related rules

to-top