Potential Persistence Through Systemd-udevd

Monitors for the creation of rule files that are used by systemd-udevd to manage device nodes and handle kernel device events in the Linux operating system. Systemd-udevd can be exploited for persistence by adversaries by creating malicious udev rules that trigger on specific events, executing arbitrary commands or payloads whenever a certain device is plugged in or recognized by the system.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2023/10/26"
 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 = "2024/02/22"
 8
 9[rule]
10author = ["Elastic"]
11description = """
12Monitors for the creation of rule files that are used by systemd-udevd to manage device nodes and handle kernel device
13events in the Linux operating system. Systemd-udevd can be exploited for persistence by adversaries by creating
14malicious udev rules that trigger on specific events, executing arbitrary commands or payloads whenever a certain device
15is plugged in or recognized by the system.
16"""
17from = "now-9m"
18index = ["logs-endpoint.events.*", "endgame-*"]
19language = "kuery"
20license = "Elastic License v2"
21name = "Potential Persistence Through Systemd-udevd"
22risk_score = 21
23rule_id = "054db96b-fd34-43b3-9af2-587b3bd33964"
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: Persistence",
56        "Data Source: Elastic Endgame",
57        "Data Source: Elastic Defend"
58        ]
59type = "new_terms"
60timestamp_override = "event.ingested"
61query = '''
62host.os.type:"linux" and event.category:"file" and
63event.type:("change" or "file_modify_event" or "creation" or "file_create_event") and
64file.path:/lib/udev/* and process.executable:* and not (
65   process.name:("dockerd" or "docker" or "dpkg" or "dnf" or "dnf-automatic" or "yum" or "rpm" or "systemd-hwdb" or
66     "podman" or "buildah") or file.extension : ("swp" or "swpx")
67)
68'''
69
70[[rule.threat]]
71framework = "MITRE ATT&CK"
72
73[[rule.threat.technique]]
74id = "T1037"
75name = "Boot or Logon Initialization Scripts"
76reference = "https://attack.mitre.org/techniques/T1037/"
77
78[rule.threat.tactic]
79id = "TA0003"
80name = "Persistence"
81reference = "https://attack.mitre.org/tactics/TA0003/"
82
83[rule.new_terms]
84field = "new_terms_fields"
85value = ["host.id", "process.executable", "file.path"]
86
87[[rule.new_terms.history_window_start]]
88field = "history_window_start"
89value = "now-14d"

Related rules

to-top