Network Activity Detected via Kworker

This rule monitors for network connections from a 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.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2023/10/18"
  3integration = ["endpoint"]
  4maturity = "production"
  5updated_date = "2025/01/24"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10This rule monitors for network connections from a kworker process. kworker, or kernel worker, processes are part of the
 11kernel's workqueue mechanism. They are responsible for executing work that has been scheduled to be done in kernel
 12space, which might include tasks like handling interrupts, background activities, and other kernel-related tasks.
 13Attackers may attempt to evade detection by masquerading as a kernel worker process.
 14"""
 15from = "now-9m"
 16index = ["logs-endpoint.events.*"]
 17language = "kuery"
 18license = "Elastic License v2"
 19name = "Network Activity Detected via Kworker"
 20risk_score = 21
 21rule_id = "25d917c4-aa3c-4111-974c-286c0312ff95"
 22setup = """## Setup
 23
 24This rule requires data coming in from Elastic Defend.
 25
 26### Elastic Defend Integration Setup
 27Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows
 28the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
 29
 30#### Prerequisite Requirements:
 31- Fleet is required for Elastic Defend.
 32- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
 33
 34#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
 35- Go to the Kibana home page and click "Add integrations".
 36- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
 37- Click "Add Elastic Defend".
 38- Configure the integration name and optionally add a description.
 39- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
 40- 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).
 41- We suggest to select "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
 42- 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.
 43For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
 44- Click "Save and Continue".
 45- 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.
 46For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
 47"""
 48severity = "low"
 49tags = [
 50    "Domain: Endpoint",
 51    "OS: Linux",
 52    "Use Case: Threat Detection",
 53    "Tactic: Command and Control",
 54    "Data Source: Elastic Defend",
 55    "Resources: Investigation Guide",
 56]
 57timestamp_override = "event.ingested"
 58type = "new_terms"
 59
 60query = '''
 61host.os.type:linux and event.category:network and event.action:(connection_attempted or connection_accepted) and
 62process.name:kworker* and not destination.ip:(
 63  10.0.0.0/8 or
 64  127.0.0.0/8 or
 65  169.254.0.0/16 or
 66  172.16.0.0/12 or
 67  192.168.0.0/16 or
 68  224.0.0.0/4 or
 69  "::1" or
 70  "FE80::/10" or
 71  "FF00::/8" or
 72  "0.0.0.0"
 73) and not destination.port:("2049" or "111" or "892" or "597")
 74'''
 75note = """## Triage and analysis
 76
 77> **Disclaimer**:
 78> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
 79
 80### Investigating Network Activity Detected via Kworker
 81
 82Kworker processes are integral to Linux systems, handling kernel tasks like interrupts and background activities. Adversaries may exploit these processes to mask malicious network activities, evading detection by blending in with legitimate kernel operations. The detection rule identifies suspicious network connections initiated by kworker processes, excluding trusted IP ranges and ports, to uncover potential command and control activities.
 83
 84### Possible investigation steps
 85
 86- Review the alert details to confirm the kworker process is indeed initiating network connections, focusing on the process.name field.
 87- Examine the destination IP address and port to determine if the connection is to an untrusted or suspicious external network, as the rule excludes trusted IP ranges and ports.
 88- Check historical data for any previous alerts or network activity involving the same kworker process to identify patterns or repeated behavior.
 89- Investigate the source host for any signs of compromise or unusual activity, such as unauthorized access attempts or unexpected process executions.
 90- Correlate the network activity with other security events or logs from the same timeframe to identify potential indicators of compromise or related malicious activities.
 91
 92### False positive analysis
 93
 94- Network monitoring tools or legitimate applications may occasionally use kworker processes for routine checks or updates, leading to false positives. Users can create exceptions for these specific applications by identifying their typical IP ranges and ports.
 95- Internal network scanning or monitoring activities might trigger alerts. To mitigate this, users should exclude known internal IP ranges and ports used by these activities from the detection rule.
 96- Automated backup or synchronization services that operate in the background could be mistaken for suspicious activity. Users should identify these services and adjust the rule to exclude their associated network traffic.
 97- Some system updates or maintenance tasks might temporarily use kworker processes for network communication. Users can whitelist the IP addresses and ports associated with these tasks to prevent false alerts.
 98- If a specific kworker process consistently triggers alerts without any malicious intent, users should investigate the process's behavior and, if deemed safe, add it to an exception list to avoid future false positives.
 99
100### Response and remediation
101
102- Isolate the affected system from the network to prevent further malicious activity and potential lateral movement by the attacker.
103- Terminate any suspicious kworker processes identified as initiating unauthorized network connections to halt ongoing malicious activities.
104- Conduct a thorough forensic analysis of the affected system to identify any additional indicators of compromise, such as unauthorized files or processes, and remove them.
105- Update and patch the affected system to the latest security standards to close any vulnerabilities that may have been exploited.
106- Monitor network traffic for any further suspicious activity originating from other systems, indicating potential spread or persistence of the threat.
107- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems are compromised.
108- Implement enhanced monitoring and logging for kworker processes and network activities to improve detection of similar threats in the future."""
109
110[[rule.threat]]
111framework = "MITRE ATT&CK"
112
113[rule.threat.tactic]
114id = "TA0011"
115name = "Command and Control"
116reference = "https://attack.mitre.org/tactics/TA0011/"
117
118[[rule.threat]]
119framework = "MITRE ATT&CK"
120
121[[rule.threat.technique]]
122id = "T1014"
123name = "Rootkit"
124reference = "https://attack.mitre.org/techniques/T1014/"
125
126[[rule.threat.technique]]
127id = "T1036"
128name = "Masquerading"
129reference = "https://attack.mitre.org/techniques/T1036/"
130
131[rule.threat.tactic]
132id = "TA0005"
133name = "Defense Evasion"
134reference = "https://attack.mitre.org/tactics/TA0005/"
135
136[[rule.threat]]
137framework = "MITRE ATT&CK"
138
139[[rule.threat.technique]]
140id = "T1041"
141name = "Exfiltration Over C2 Channel"
142reference = "https://attack.mitre.org/techniques/T1041/"
143
144[rule.threat.tactic]
145id = "TA0010"
146name = "Exfiltration"
147reference = "https://attack.mitre.org/tactics/TA0010/"
148
149[rule.new_terms]
150field = "new_terms_fields"
151value = ["process.name", "host.id"]
152
153[[rule.new_terms.history_window_start]]
154field = "history_window_start"
155value = "now-14d"
...
toml

Disclaimer: This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.

Kworker processes are integral to Linux systems, handling kernel tasks like interrupts and background activities. Adversaries may exploit these processes to mask malicious network activities, evading detection by blending in with legitimate kernel operations. The detection rule identifies suspicious network connections initiated by kworker processes, excluding trusted IP ranges and ports, to uncover potential command and control activities.

  • Review the alert details to confirm the kworker process is indeed initiating network connections, focusing on the process.name field.
  • Examine the destination IP address and port to determine if the connection is to an untrusted or suspicious external network, as the rule excludes trusted IP ranges and ports.
  • Check historical data for any previous alerts or network activity involving the same kworker process to identify patterns or repeated behavior.
  • Investigate the source host for any signs of compromise or unusual activity, such as unauthorized access attempts or unexpected process executions.
  • Correlate the network activity with other security events or logs from the same timeframe to identify potential indicators of compromise or related malicious activities.
  • Network monitoring tools or legitimate applications may occasionally use kworker processes for routine checks or updates, leading to false positives. Users can create exceptions for these specific applications by identifying their typical IP ranges and ports.
  • Internal network scanning or monitoring activities might trigger alerts. To mitigate this, users should exclude known internal IP ranges and ports used by these activities from the detection rule.
  • Automated backup or synchronization services that operate in the background could be mistaken for suspicious activity. Users should identify these services and adjust the rule to exclude their associated network traffic.
  • Some system updates or maintenance tasks might temporarily use kworker processes for network communication. Users can whitelist the IP addresses and ports associated with these tasks to prevent false alerts.
  • If a specific kworker process consistently triggers alerts without any malicious intent, users should investigate the process's behavior and, if deemed safe, add it to an exception list to avoid future false positives.
  • Isolate the affected system from the network to prevent further malicious activity and potential lateral movement by the attacker.
  • Terminate any suspicious kworker processes identified as initiating unauthorized network connections to halt ongoing malicious activities.
  • Conduct a thorough forensic analysis of the affected system to identify any additional indicators of compromise, such as unauthorized files or processes, and remove them.
  • Update and patch the affected system to the latest security standards to close any vulnerabilities that may have been exploited.
  • Monitor network traffic for any further suspicious activity originating from other systems, indicating potential spread or persistence of the threat.
  • Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems are compromised.
  • Implement enhanced monitoring and logging for kworker processes and network activities to improve detection of similar threats in the future.

Related rules

to-top