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/03/08"
  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 = """## 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: Defense Evasion",
 61        "Data Source: Elastic Endgame",
 62        "Data Source: Elastic Defend"
 63        ]
 64timestamp_override = "event.ingested"
 65type = "eql"
 66
 67query = '''
 68process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event") and
 69process.name == "rmmod" or (process.name == "modprobe" and process.args in ("--remove", "-r")) and 
 70process.parent.name in ("sudo", "bash", "dash", "ash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")
 71'''
 72
 73[[rule.threat]]
 74framework = "MITRE ATT&CK"
 75
 76[[rule.threat.technique]]
 77id = "T1562"
 78name = "Impair Defenses"
 79reference = "https://attack.mitre.org/techniques/T1562/"
 80
 81[[rule.threat.technique.subtechnique]]
 82id = "T1562.001"
 83name = "Disable or Modify Tools"
 84reference = "https://attack.mitre.org/techniques/T1562/001/"
 85
 86[rule.threat.tactic]
 87id = "TA0005"
 88name = "Defense Evasion"
 89reference = "https://attack.mitre.org/tactics/TA0005/"
 90
 91[[rule.threat]]
 92framework = "MITRE ATT&CK"
 93
 94[[rule.threat.technique]]
 95id = "T1547"
 96name = "Boot or Logon Autostart Execution"
 97reference = "https://attack.mitre.org/techniques/T1547/"
 98
 99[[rule.threat.technique.subtechnique]]
100id = "T1547.006"
101name = "Kernel Modules and Extensions"
102reference = "https://attack.mitre.org/techniques/T1547/006/"
103
104[rule.threat.tactic]
105id = "TA0003"
106name = "Persistence"
107reference = "https://attack.mitre.org/tactics/TA0003/"

References

Related rules

to-top