Yum Package Manager Plugin File Creation
Detects file creation events in the plugin directories for the Yum package manager. In Linux, Yum (Yellowdog Updater, Modified) is a command-line utility used for handling packages on (by default) Fedora-based systems, providing functions for installing, updating, upgrading, and removing software along with managing package repositories. Attackers can backdoor Yum to gain persistence by injecting malicious code into plugins that Yum runs, thereby ensuring continued unauthorized access or control each time Yum is used for package management.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2024/06/25"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2024/07/09"
6
7[rule]
8author = ["Elastic"]
9description = """
10Detects file creation events in the plugin directories for the Yum package manager. In Linux, Yum (Yellowdog Updater,
11Modified) is a command-line utility used for handling packages on (by default) Fedora-based systems, providing functions
12for installing, updating, upgrading, and removing software along with managing package repositories. Attackers can
13backdoor Yum to gain persistence by injecting malicious code into plugins that Yum runs, thereby ensuring continued
14unauthorized access or control each time Yum is used for package management.
15"""
16from = "now-9m"
17index = ["logs-endpoint.events.file*"]
18language = "eql"
19license = "Elastic License v2"
20name = "Yum Package Manager Plugin File Creation"
21references = ["https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/linux/local/yum_package_manager_persistence.rb"]
22risk_score = 21
23rule_id = "0b15bcad-aff1-4250-a5be-5d1b7eb56d07"
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 the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
30
31#### Prerequisite Requirements:
32- Fleet is required for Elastic Defend.
33- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
34
35#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
36- Go to the Kibana home page and click "Add integrations".
37- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
38- Click "Add Elastic Defend".
39- Configure the integration name and optionally add a description.
40- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
41- 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).
42- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
43- 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.
44For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
45- Click "Save and Continue".
46- 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.
47For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
48"""
49severity = "low"
50tags = [
51 "Domain: Endpoint",
52 "OS: Linux",
53 "Use Case: Threat Detection",
54 "Tactic: Persistence",
55 "Tactic: Defense Evasion",
56 "Data Source: Elastic Defend",
57]
58timestamp_override = "event.ingested"
59type = "eql"
60query = '''
61file where host.os.type == "linux" and event.action in ("rename", "creation") and
62file.path : ("/usr/lib/yum-plugins/*", "/etc/yum/pluginconf.d/*") and not (
63 process.executable in (
64 "/bin/dockerd", "/usr/bin/dockerd", "/usr/sbin/dockerd", "/bin/microdnf", "/usr/bin/microdnf", "/bin/rpm",
65 "/usr/bin/rpm", "/bin/snapd", "/usr/bin/snapd", "/bin/yum", "/usr/bin/yum", "/bin/dnf", "/usr/bin/dnf",
66 "/bin/podman", "/usr/bin/podman", "/bin/dnf-automatic", "/usr/bin/dnf-automatic", "/sbin/apk", "/usr/sbin/apk",
67 "/usr/local/sbin/apk", "/bin/podman", "/usr/bin/podman", "/usr/bin/puppet", "/bin/puppet",
68 "/opt/puppetlabs/puppet/bin/puppet", "/usr/bin/chef-client", "/bin/chef-client", "/bin/autossl_check",
69 "/usr/bin/autossl_check", "/proc/self/exe", "/dev/fd/*", "/usr/lib/snapd/snapd", "/usr/local/bin/dockerd",
70 "/usr/libexec/netplan/generate"
71 ) or
72 process.name == "yumBackend.py" or
73 file.extension in ("swp", "swpx", "swx") or
74 process.executable : (
75 "/nix/store/*", "/var/lib/dpkg/*", "/tmp/vmis.*", "/snap/*", "/dev/fd/*", "/usr/lib/*", "/usr/libexec/*",
76 "/etc/kernel/*"
77 ) or
78 process.executable == null or
79 (process.name == "sed" and file.name : "sed*") or
80 (process.name == "perl" and file.name : "e2scrub_all.tmp*")
81)
82'''
83
84[[rule.threat]]
85framework = "MITRE ATT&CK"
86
87[[rule.threat.technique]]
88id = "T1546"
89name = "Event Triggered Execution"
90reference = "https://attack.mitre.org/techniques/T1546/"
91
92[[rule.threat.technique.subtechnique]]
93id = "T1546.016"
94name = "Installer Packages"
95reference = "https://attack.mitre.org/techniques/T1546/016/"
96
97[[rule.threat.technique]]
98id = "T1543"
99name = "Create or Modify System Process"
100reference = "https://attack.mitre.org/techniques/T1543/"
101
102[[rule.threat.technique]]
103id = "T1574"
104name = "Hijack Execution Flow"
105reference = "https://attack.mitre.org/techniques/T1574/"
106
107[rule.threat.tactic]
108id = "TA0003"
109name = "Persistence"
110reference = "https://attack.mitre.org/tactics/TA0003/"
111
112[[rule.threat]]
113framework = "MITRE ATT&CK"
114
115[rule.threat.tactic]
116id = "TA0005"
117name = "Defense Evasion"
118reference = "https://attack.mitre.org/tactics/TA0005/"
References
Related rules
- APT Package Manager Configuration File Creation
- DNF Package Manager Plugin File Creation
- Suspicious APT Package Manager Execution
- Git Hook Child Process
- Git Hook Created or Modified