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

References

Related rules

to-top