Suspicious Kworker UID Elevation

Monitors for the elevation of regular user permissions to root permissions through the kworker process. kworker, or kernel worker, processes are part of the kernel's workqueue mechanism. They are responsible for executing work that has been scheduled to be done in kernel space, which might include tasks like handling interrupts, background activities, and other kernel-related tasks. Attackers may attempt to evade detection by masquerading as a kernel worker process, and hijack the execution flow by hooking certain functions/syscalls through a rootkit in order to provide easy access to root via a special modified command.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2023/10/26"
 3integration = ["endpoint"]
 4maturity = "production"
 5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
 6min_stack_version = "8.3.0"
 7updated_date = "2023/10/26"
 8
 9[rule]
10author = ["Elastic"]
11description = """
12Monitors for the elevation of regular user permissions to root permissions through the kworker process. kworker, or
13kernel worker, processes are part of the kernel's workqueue mechanism. They are responsible for executing work that has
14been scheduled to be done in kernel space, which might include tasks like handling interrupts, background activities,
15and other kernel-related tasks. Attackers may attempt to evade detection by masquerading as a kernel worker process, and
16hijack the execution flow by hooking certain functions/syscalls through a rootkit in order to provide easy access to
17root via a special modified command.
18"""
19from = "now-9m"
20index = ["logs-endpoint.events.*"]
21language = "eql"
22license = "Elastic License v2"
23name = "Suspicious Kworker UID Elevation"
24risk_score = 47
25rule_id = "7dfaaa17-425c-4fe7-bd36-83705fde7c2b"
26setup = """
27
28This rule requires data coming in from Elastic Defend.
29
30### Elastic Defend Integration Setup
31Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows
32the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
33
34#### Prerequisite Requirements:
35- Fleet is required for Elastic Defend.
36- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
37
38#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
39- Go to the Kibana home page and click Add integrations.
40- In the query bar, search for Elastic Defend and select the integration to see more details about it.
41- Click Add Elastic Defend.
42- Configure the integration name and optionally add a description.
43- Select the type of environment you want to protect, either Traditional Endpoints or Cloud Workloads.
44- 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).
45- We suggest to select "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
46- 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.
47For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
48- Click Save and Continue.
49- 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.
50For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
51
52"""
53severity = "medium"
54tags = [
55        "Domain: Endpoint",
56        "OS: Linux",
57        "Use Case: Threat Detection",
58        "Tactic: Privilege Escalation",
59        "Tactic: Defense Evasion",
60        "Data Source: Elastic Defend"
61        ]
62timestamp_override = "event.ingested"
63type = "eql"
64query = '''
65process where host.os.type == "linux" and event.action == "session_id_change" and event.type == "change" and
66process.name : "kworker*" and user.id == "0"
67'''
68
69[[rule.threat]]
70framework = "MITRE ATT&CK"
71
72[[rule.threat.technique]]
73id = "T1574"
74name = "Hijack Execution Flow"
75reference = "https://attack.mitre.org/techniques/T1574/"
76
77[[rule.threat.technique.subtechnique]]
78id = "T1574.013"
79name = "KernelCallbackTable"
80reference = "https://attack.mitre.org/techniques/T1574/013/"
81
82[rule.threat.tactic]
83id = "TA0004"
84name = "Privilege Escalation"
85reference = "https://attack.mitre.org/tactics/TA0004/"
86
87[[rule.threat]]
88framework = "MITRE ATT&CK"
89
90[rule.threat.tactic]
91id = "TA0005"
92name = "Defense Evasion"
93reference = "https://attack.mitre.org/tactics/TA0005/"
94
95[[rule.threat.technique]]
96name = "Rootkit"
97id = "T1014"
98reference = "https://attack.mitre.org/techniques/T1014/"

Related rules

to-top