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"
  5min_stack_comments = "Multiple field support in the New Terms rule type was added in Elastic 8.6"
  6min_stack_version = "8.6.0"
  7updated_date = "2023/12/12"
  8
  9[rule]
 10author = ["Elastic"]
 11description = """
 12This rule monitors for network connections from a kworker process. kworker, or kernel worker, processes are part of the
 13kernel's workqueue mechanism. They are responsible for executing work that has been scheduled to be done in kernel 
 14space, which might include tasks like handling interrupts, background activities, and other kernel-related tasks. 
 15Attackers may attempt to evade detection by masquerading as a kernel worker process.
 16"""
 17from = "now-60m"
 18index = ["logs-endpoint.events.*"]
 19language = "kuery"
 20license = "Elastic License v2"
 21name = "Network Activity Detected via Kworker"
 22risk_score = 21
 23rule_id = "25d917c4-aa3c-4111-974c-286c0312ff95"
 24setup = """## Setup
 25
 26This rule requires data coming in from Elastic Defend.
 27
 28### Elastic Defend Integration Setup
 29Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows
 30the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
 31
 32#### Prerequisite Requirements:
 33- Fleet is required for Elastic Defend.
 34- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
 35
 36#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
 37- Go to the Kibana home page and click "Add integrations".
 38- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
 39- Click "Add Elastic Defend".
 40- Configure the integration name and optionally add a description.
 41- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
 42- 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).
 43- We suggest to select "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
 44- 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.
 45For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
 46- Click "Save and Continue".
 47- 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.
 48For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
 49"""
 50severity = "low"
 51tags = [
 52        "Domain: Endpoint",
 53        "OS: Linux",
 54        "Use Case: Threat Detection",
 55        "Tactic: Command and Control",
 56        "Data Source: Elastic Defend"
 57        ]
 58timestamp_override = "event.ingested"
 59type = "new_terms"
 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"
 72)
 73'''
 74
 75[[rule.threat]]
 76framework = "MITRE ATT&CK"
 77
 78  [rule.threat.tactic]
 79  id = "TA0011"
 80  name = "Command and Control"
 81  reference = "https://attack.mitre.org/tactics/TA0011/"
 82
 83[[rule.threat]]
 84framework = "MITRE ATT&CK"
 85
 86  [rule.threat.tactic]
 87  id = "TA0005"
 88  name = "Defense Evasion"
 89  reference = "https://attack.mitre.org/tactics/TA0005/"
 90
 91  [[rule.threat.technique]]
 92  name = "Masquerading"
 93  id = "T1036"
 94  reference = "https://attack.mitre.org/techniques/T1036/"
 95
 96  [[rule.threat.technique]]
 97  name = "Rootkit"
 98  id = "T1014"
 99  reference = "https://attack.mitre.org/techniques/T1014/"
100
101[[rule.threat]]
102framework = "MITRE ATT&CK"
103
104  [rule.threat.tactic]
105  id = "TA0010"
106  name = "Exfiltration"
107  reference = "https://attack.mitre.org/tactics/TA0010/"
108
109  [[rule.threat.technique]]
110  name = "Exfiltration Over C2 Channel"
111  id = "T1041"
112  reference = "https://attack.mitre.org/techniques/T1041/"
113
114[rule.new_terms]
115field = "new_terms_fields"
116value = ["host.id", "process.name", "destination.ip"]
117
118[[rule.new_terms.history_window_start]]
119field = "history_window_start"
120value = "now-14d"

Related rules

to-top