Skip to content

Commit 83734b4

Browse files
committed
[New Rule] Unusual Execution from Kernel Thread (kthreadd) Parent
1 parent d72cb92 commit 83734b4

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
[metadata]
2+
creation_date = "2025/04/30"
3+
integration = ["endpoint"]
4+
maturity = "production"
5+
updated_date = "2025/04/30"
6+
7+
[rule]
8+
author = ["Elastic"]
9+
description = """
10+
This rule detects suspicious child process from the kernel thread (kthreadd) parent process. Attackers may execute payloads from
11+
kernel space via kthreadd to perform actions on the host and evade detection. Through the usage of the new_terms rule type, this
12+
rule can identify uncommon child processes that may indicate the presence of a malicious process.
13+
"""
14+
from = "now-9m"
15+
index = ["logs-endpoint.events.process*"]
16+
language = "kuery"
17+
license = "Elastic License v2"
18+
name = "Unusual Execution from Kernel Thread (kthreadd) Parent"
19+
risk_score = 47
20+
rule_id = "656739a8-2786-402b-8ee1-22e0762b63ba"
21+
setup = """## Setup
22+
23+
This rule requires data coming in from Elastic Defend.
24+
25+
### Elastic Defend Integration Setup
26+
Elastic 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.
27+
28+
#### Prerequisite Requirements:
29+
- Fleet is required for Elastic Defend.
30+
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
31+
32+
#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
33+
- Go to the Kibana home page and click "Add integrations".
34+
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
35+
- Click "Add Elastic Defend".
36+
- Configure the integration name and optionally add a description.
37+
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
38+
- 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).
39+
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
40+
- 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.
41+
42+
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
43+
- Click "Save and Continue".
44+
- 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.
45+
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
46+
"""
47+
severity = "medium"
48+
tags = [
49+
"Domain: Endpoint",
50+
"OS: Linux",
51+
"Use Case: Threat Detection",
52+
"Tactic: Execution",
53+
"Data Source: Elastic Defend",
54+
]
55+
timestamp_override = "event.ingested"
56+
type = "new_terms"
57+
query = '''
58+
host.os.type:linux and event.category:process and event.type:start and event.action:exec and process.parent.name:kthreadd and (
59+
process.executable:("/tmp/*" or "/var/tmp/*" or "/dev/shm/*" or "/var/www/*") or
60+
process.name:(bash or dash or sh or tcsh or csh or zsh or ksh or fish or whoami or curl or wget or id or nohup or setsid)
61+
) and
62+
process.command_line:(
63+
*cron* or */etc/rc.local* or */dev/tcp/* or */etc/init.d* or */etc/ld.so* or */etc/sudoers* or *base64 * or */etc/profile* or
64+
*/dev/shm/* or */etc/ssh* or */home/*/.ssh/* or */root/.ssh* or *~/.ssh/* or *xxd * or */etc/shadow* or */tmp/* or
65+
*/var/tmp/* or */var/www/* or */var/log/* or */var/run/*
66+
) and not (
67+
process.name:(dpkg or true or flock or uname or mount or umount or cifs.upcall or touch or gdbus or grep or getopt) or
68+
process.command_line:"sh -c /bin/true" or
69+
process.executable:(/tmp/newroot/* or /var/lib/docker/overlay2/* or /vz/root/* or /lib/systemd/systemd-cgroups-agent or /usr/local/axs-haproxy-monitoring/haproxy_stats.sh or /proc/self/exe) or
70+
process.command_line:(*/bin/ps* or *pgrep* or *omsagent* or */usr/bin/find* or */usr/bin/grep* or *ds_agent* or *nagios* or *gitlabrunner*)
71+
)
72+
'''
73+
74+
[[rule.threat]]
75+
framework = "MITRE ATT&CK"
76+
77+
[rule.threat.tactic]
78+
name = "Execution"
79+
id = "TA0002"
80+
reference = "https://attack.mitre.org/tactics/TA0002/"
81+
82+
[[rule.threat.technique]]
83+
id = "T1059"
84+
name = "Command and Scripting Interpreter"
85+
reference = "https://attack.mitre.org/techniques/T1059/"
86+
87+
[[rule.threat.technique.subtechnique]]
88+
name = "Unix Shell"
89+
id = "T1059.004"
90+
reference = "https://attack.mitre.org/techniques/T1059/004/"
91+
92+
[rule.new_terms]
93+
field = "new_terms_fields"
94+
value = ["process.name", "host.id"]
95+
96+
[[rule.new_terms.history_window_start]]
97+
field = "history_window_start"
98+
value = "now-14d"

0 commit comments

Comments
 (0)