Kernel Driver Load by non-root User

Detects the loading of a Linux kernel module by a non-root user through system calls. Threat actors may leverage Linux kernel modules to load a rootkit on a system providing them with complete control and the ability to hide from security products. As other rules monitor for the addition of Linux kernel modules through system utilities or .ko files, this rule covers the gap that evasive rootkits leverage by monitoring for kernel module additions on the lowest level through auditd_manager.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2024/01/10"
 3integration = ["auditd_manager"]
 4maturity = "production"
 5updated_date = "2024/05/21"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10Detects the loading of a Linux kernel module by a non-root user through system calls. Threat actors may leverage Linux
11kernel modules to load a rootkit on a system providing them with complete control and the ability to hide from security
12products. As other rules monitor for the addition of Linux kernel modules through system utilities or .ko files, this
13rule covers the gap that evasive rootkits leverage by monitoring for kernel module additions on the lowest level through
14auditd_manager.
15"""
16from = "now-9m"
17index = ["logs-auditd_manager.auditd-*"]
18language = "eql"
19license = "Elastic License v2"
20name = "Kernel Driver Load by non-root User"
21risk_score = 47
22rule_id = "ba81c182-4287-489d-af4d-8ae834b06040"
23setup = """## Setup
24
25
26This rule requires data coming in from Auditd Manager.
27
28### Auditd Manager Integration Setup
29The Auditd Manager Integration receives audit events from the Linux Audit Framework which is a part of the Linux kernel.
30Auditd Manager provides a user-friendly interface and automation capabilities for configuring and monitoring system auditing through the auditd daemon. With `auditd_manager`, administrators can easily define audit rules, track system events, and generate comprehensive audit reports, improving overall security and compliance in the system.
31
32#### The following steps should be executed in order to add the Elastic Agent System integration "auditd_manager" on a Linux System:
33- Go to the Kibana home page and click “Add integrations”.
34- In the query bar, search for “Auditd Manager” and select the integration to see more details about it.
35- Click “Add Auditd Manager”.
36- Configure the integration name and optionally add a description.
37- Review optional and advanced settings accordingly.
38- Add the newly installed “auditd manager” to an existing or a new agent policy, and deploy the agent on a Linux system from which auditd log files are desirable.
39- Click “Save and Continue”.
40- For more details on the integration refer to the [helper guide](https://docs.elastic.co/integrations/auditd_manager).
41
42#### Rule Specific Setup Note
43Auditd Manager subscribes to the kernel and receives events as they occur without any additional configuration.
44However, if more advanced configuration is required to detect specific behavior, audit rules can be added to the integration in either the "audit rules" configuration box or the "auditd rule files" box by specifying a file to read the audit rules from.
45- For this detection rule the following additional audit rules are required to be added to the integration:
46  -- "-a always,exit -F arch=b64 -S finit_module -S init_module -S delete_module -F auid!=-1 -k modules"
47  -- "-a always,exit -F arch=b32 -S finit_module -S init_module -S delete_module -F auid!=-1 -k modules"
48"""
49severity = "medium"
50tags = [
51    "Data Source: Auditd Manager",
52    "Domain: Endpoint",
53    "OS: Linux",
54    "Use Case: Threat Detection",
55    "Tactic: Persistence",
56    "Tactic: Defense Evasion",
57]
58timestamp_override = "event.ingested"
59type = "eql"
60
61query = '''
62driver where host.os.type == "linux" and event.action == "loaded-kernel-module" and
63auditd.data.syscall in ("init_module", "finit_module") and user.id != "0"
64'''
65
66
67[[rule.threat]]
68framework = "MITRE ATT&CK"
69[[rule.threat.technique]]
70id = "T1547"
71name = "Boot or Logon Autostart Execution"
72reference = "https://attack.mitre.org/techniques/T1547/"
73[[rule.threat.technique.subtechnique]]
74id = "T1547.006"
75name = "Kernel Modules and Extensions"
76reference = "https://attack.mitre.org/techniques/T1547/006/"
77
78
79
80[rule.threat.tactic]
81id = "TA0003"
82name = "Persistence"
83reference = "https://attack.mitre.org/tactics/TA0003/"
84[[rule.threat]]
85framework = "MITRE ATT&CK"
86[[rule.threat.technique]]
87id = "T1014"
88name = "Rootkit"
89reference = "https://attack.mitre.org/techniques/T1014/"
90
91
92[rule.threat.tactic]
93id = "TA0005"
94name = "Defense Evasion"
95reference = "https://attack.mitre.org/tactics/TA0005/"

Related rules

to-top