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

Related rules

to-top