Unusual Execution from Kernel Thread (kthreadd) Parent
This rule detects suspicious child process from the kernel thread (kthreadd) parent process. Attackers may execute payloads from kernel space via kthreadd to perform actions on the host and evade detection. Through the usage of the new_terms rule type, this rule can identify uncommon child processes that may indicate the presence of a malicious process.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2025/04/30"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2025/04/30"
6
7[rule]
8author = ["Elastic"]
9description = """
10This rule detects suspicious child process from the kernel thread (kthreadd) parent process. Attackers may execute payloads from
11kernel space via kthreadd to perform actions on the host and evade detection. Through the usage of the new_terms rule type, this
12rule can identify uncommon child processes that may indicate the presence of a malicious process.
13"""
14from = "now-9m"
15index = ["logs-endpoint.events.process*"]
16language = "kuery"
17license = "Elastic License v2"
18name = "Unusual Execution from Kernel Thread (kthreadd) Parent"
19risk_score = 47
20rule_id = "656739a8-2786-402b-8ee1-22e0762b63ba"
21setup = """## Setup
22
23This rule requires data coming in from Elastic Defend.
24
25### Elastic Defend Integration Setup
26Elastic 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
42For 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.
45For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
46"""
47severity = "medium"
48tags = [
49 "Domain: Endpoint",
50 "OS: Linux",
51 "Use Case: Threat Detection",
52 "Tactic: Execution",
53 "Data Source: Elastic Defend",
54]
55timestamp_override = "event.ingested"
56type = "new_terms"
57query = '''
58host.os.type:linux and event.category:process and event.type:start and event.action:exec and process.parent.name:kthreadd and (
59 process.executable:(/dev/shm/* or /tmp/* or /var/tmp/* or /var/www/*) or
60 process.name:(bash or csh or curl or dash or fish or id or ksh or nohup or setsid or sh or tcsh or wget or whoami or zsh)
61) and
62process.command_line:(
63 */dev/shm/* or */dev/tcp/* or */etc/init.d* or */etc/ld.so* or */etc/profile* or */etc/rc.local* or */etc/shadow* or */etc/ssh* or
64 */etc/sudoers* or */home/*/.ssh/* or */root/.ssh* or */tmp/* or */var/log/* or */var/run/* or */var/tmp/* or */var/www/* or
65 *base64* or *cron* or *xxd* or *~/.ssh/*
66) and not (
67 process.name:(true or cifs.upcall or dpkg or flock or gdbus or getopt or grep or mount or touch or umount or uname) or
68 process.command_line:(
69 "sh -c /bin/true" or */bin/ps* or */usr/bin/find* or */usr/bin/grep* or *ds_agent* or *gitlabrunner* or *nagios* or
70 *omsagent* or *pgrep*
71 ) or
72 process.executable:(
73 /lib/systemd/systemd-cgroups-agent or /proc/self/exe or /usr/local/axs-haproxy-monitoring/haproxy_stats.sh or /tmp/newroot/* or
74 /var/lib/docker/overlay2/* or /vz/root/*
75 )
76)
77'''
78
79[[rule.threat]]
80framework = "MITRE ATT&CK"
81
82 [rule.threat.tactic]
83 name = "Execution"
84 id = "TA0002"
85 reference = "https://attack.mitre.org/tactics/TA0002/"
86
87 [[rule.threat.technique]]
88 id = "T1059"
89 name = "Command and Scripting Interpreter"
90 reference = "https://attack.mitre.org/techniques/T1059/"
91
92 [[rule.threat.technique.subtechnique]]
93 name = "Unix Shell"
94 id = "T1059.004"
95 reference = "https://attack.mitre.org/techniques/T1059/004/"
96
97[rule.new_terms]
98field = "new_terms_fields"
99value = ["process.name", "host.id"]
100
101[[rule.new_terms.history_window_start]]
102field = "history_window_start"
103value = "now-14d"
Related rules
- Suspicious Named Pipe Creation
- Potential Hex Payload Execution via Command-Line
- Potential Hex Payload Execution via Common Utility
- Base64 Decoded Payload Piped to Interpreter
- File Creation in /var/log via Suspicious Process