DPKG Package Installed by Unusual Parent Process
This rule detects the installation of a Debian package (dpkg) by an unusual parent process. The dpkg command is used to install, remove, and manage Debian packages on a Linux system. Attackers can abuse the dpkg command to install malicious packages on a system.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2024/07/09"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2025/01/15"
6
7[rule]
8author = ["Elastic"]
9description = """
10This rule detects the installation of a Debian package (dpkg) by an unusual parent process. The dpkg command is used to
11install, remove, and manage Debian packages on a Linux system. Attackers can abuse the dpkg command to install malicious
12packages on a system.
13"""
14from = "now-9m"
15index = ["logs-endpoint.events.*"]
16language = "kuery"
17license = "Elastic License v2"
18name = "DPKG Package Installed by Unusual Parent Process"
19references = ["https://www.makeuseof.com/how-deb-packages-are-backdoored-how-to-detect-it/"]
20risk_score = 21
21rule_id = "f4d1c0ac-aedb-4063-9fa6-cc651eb5e6ee"
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 the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
28
29#### Prerequisite Requirements:
30- Fleet is required for Elastic Defend.
31- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
32
33#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
34- Go to the Kibana home page and click "Add integrations".
35- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
36- Click "Add Elastic Defend".
37- Configure the integration name and optionally add a description.
38- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
39- 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).
40- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
41- 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.
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 = "low"
48tags = [
49 "Domain: Endpoint",
50 "OS: Linux",
51 "Use Case: Threat Detection",
52 "Tactic: Persistence",
53 "Data Source: Elastic Defend",
54 "Resources: Investigation Guide",
55]
56timestamp_override = "event.ingested"
57type = "new_terms"
58
59query = '''
60host.os.type:linux and event.category:process and event.type:start and event.action:exec and process.name:dpkg and
61process.args:("-i" or "--install")
62'''
63note = """## Triage and analysis
64
65> **Disclaimer**:
66> 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.
67
68### Investigating DPKG Package Installed by Unusual Parent Process
69
70DPKG is a core utility for managing Debian packages on Linux systems, crucial for software installation and maintenance. Adversaries may exploit DPKG to install malicious packages, leveraging unusual parent processes to evade detection. The detection rule identifies such anomalies by monitoring DPKG executions initiated by atypical parent processes, signaling potential unauthorized package installations.
71
72### Possible investigation steps
73
74- Review the process tree to identify the parent process of the dpkg execution. Determine if the parent process is legitimate or unusual for package installations.
75- Examine the command-line arguments used with the dpkg command, specifically looking for the "-i" or "--install" flags, to understand what package was being installed.
76- Check the source and integrity of the package being installed to ensure it is from a trusted repository or source.
77- Investigate the user account under which the dpkg command was executed to determine if it has the necessary permissions and if the activity aligns with the user's typical behavior.
78- Correlate the event with other logs or alerts around the same timeframe to identify any related suspicious activities or patterns.
79- Assess the system for any signs of compromise or unauthorized changes following the package installation.
80
81### False positive analysis
82
83- System updates or maintenance scripts may trigger the rule when legitimate administrative tools or scripts use dpkg to install updates. To handle this, identify and whitelist known maintenance scripts or processes that regularly perform package installations.
84- Automated deployment tools like Ansible or Puppet might use dpkg for software deployment, leading to false positives. Exclude these tools by adding their process names to an exception list if they are part of your standard operations.
85- Custom internal applications or scripts that manage software installations could also cause alerts. Review these applications and, if verified as safe, configure exceptions for their parent processes.
86- Developers or system administrators using dpkg for testing or development purposes might inadvertently trigger the rule. Establish a policy for such activities and exclude known development environments or user accounts from triggering alerts.
87- Backup or recovery operations that reinstall packages as part of their process can be mistaken for malicious activity. Identify these operations and exclude their associated processes from the rule.
88
89### Response and remediation
90
91- Isolate the affected system from the network to prevent further unauthorized package installations or lateral movement by the adversary.
92- Terminate the dpkg process if it is still running to stop any ongoing malicious package installation.
93- Identify and remove any suspicious or unauthorized packages installed by the dpkg command using the package management tools available on the system.
94- Conduct a thorough review of the system's package installation logs and history to identify any other potentially malicious packages or unusual installation activities.
95- Restore the system from a known good backup if malicious packages have altered critical system components or configurations.
96- Implement stricter access controls and monitoring on systems to prevent unauthorized use of package management utilities by non-administrative users or processes.
97- Escalate the incident to the security operations team for further investigation and to determine if additional systems are affected, ensuring a coordinated response to the threat."""
98
99
100[[rule.threat]]
101framework = "MITRE ATT&CK"
102[[rule.threat.technique]]
103id = "T1543"
104name = "Create or Modify System Process"
105reference = "https://attack.mitre.org/techniques/T1543/"
106
107[[rule.threat.technique]]
108id = "T1546"
109name = "Event Triggered Execution"
110reference = "https://attack.mitre.org/techniques/T1546/"
111[[rule.threat.technique.subtechnique]]
112id = "T1546.016"
113name = "Installer Packages"
114reference = "https://attack.mitre.org/techniques/T1546/016/"
115
116
117[[rule.threat.technique]]
118id = "T1574"
119name = "Hijack Execution Flow"
120reference = "https://attack.mitre.org/techniques/T1574/"
121
122
123[rule.threat.tactic]
124id = "TA0003"
125name = "Persistence"
126reference = "https://attack.mitre.org/tactics/TA0003/"
127[[rule.threat]]
128framework = "MITRE ATT&CK"
129[[rule.threat.technique]]
130id = "T1195"
131name = "Supply Chain Compromise"
132reference = "https://attack.mitre.org/techniques/T1195/"
133[[rule.threat.technique.subtechnique]]
134id = "T1195.002"
135name = "Compromise Software Supply Chain"
136reference = "https://attack.mitre.org/techniques/T1195/002/"
137
138
139
140[rule.threat.tactic]
141id = "TA0001"
142name = "Initial Access"
143reference = "https://attack.mitre.org/tactics/TA0001/"
144
145[rule.new_terms]
146field = "new_terms_fields"
147value = ["process.parent.executable"]
148[[rule.new_terms.history_window_start]]
149field = "history_window_start"
150value = "now-7d"
Triage and analysis
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.
Investigating DPKG Package Installed by Unusual Parent Process
DPKG is a core utility for managing Debian packages on Linux systems, crucial for software installation and maintenance. Adversaries may exploit DPKG to install malicious packages, leveraging unusual parent processes to evade detection. The detection rule identifies such anomalies by monitoring DPKG executions initiated by atypical parent processes, signaling potential unauthorized package installations.
Possible investigation steps
- Review the process tree to identify the parent process of the dpkg execution. Determine if the parent process is legitimate or unusual for package installations.
- Examine the command-line arguments used with the dpkg command, specifically looking for the "-i" or "--install" flags, to understand what package was being installed.
- Check the source and integrity of the package being installed to ensure it is from a trusted repository or source.
- Investigate the user account under which the dpkg command was executed to determine if it has the necessary permissions and if the activity aligns with the user's typical behavior.
- Correlate the event with other logs or alerts around the same timeframe to identify any related suspicious activities or patterns.
- Assess the system for any signs of compromise or unauthorized changes following the package installation.
False positive analysis
- System updates or maintenance scripts may trigger the rule when legitimate administrative tools or scripts use dpkg to install updates. To handle this, identify and whitelist known maintenance scripts or processes that regularly perform package installations.
- Automated deployment tools like Ansible or Puppet might use dpkg for software deployment, leading to false positives. Exclude these tools by adding their process names to an exception list if they are part of your standard operations.
- Custom internal applications or scripts that manage software installations could also cause alerts. Review these applications and, if verified as safe, configure exceptions for their parent processes.
- Developers or system administrators using dpkg for testing or development purposes might inadvertently trigger the rule. Establish a policy for such activities and exclude known development environments or user accounts from triggering alerts.
- Backup or recovery operations that reinstall packages as part of their process can be mistaken for malicious activity. Identify these operations and exclude their associated processes from the rule.
Response and remediation
- Isolate the affected system from the network to prevent further unauthorized package installations or lateral movement by the adversary.
- Terminate the dpkg process if it is still running to stop any ongoing malicious package installation.
- Identify and remove any suspicious or unauthorized packages installed by the dpkg command using the package management tools available on the system.
- Conduct a thorough review of the system's package installation logs and history to identify any other potentially malicious packages or unusual installation activities.
- Restore the system from a known good backup if malicious packages have altered critical system components or configurations.
- Implement stricter access controls and monitoring on systems to prevent unauthorized use of package management utilities by non-administrative users or processes.
- Escalate the incident to the security operations team for further investigation and to determine if additional systems are affected, ensuring a coordinated response to the threat.
References
Related rules
- APT Package Manager Configuration File Creation
- At Job Created or Modified
- Bash Shell Profile Modification
- Chkconfig Service Add
- Creation or Modification of Pluggable Authentication Module or Configuration