Manual Dracut Execution

This rule detects manual execution of the dracut command on Linux systems. Dracut is a tool used to generate an initramfs image that is used to boot the system. Attackers may use dracut to create a custom initramfs image that includes malicious code or backdoors, allowing them to maintain persistence on the system.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2025/01/16"
  3integration = ["endpoint", "crowdstrike", "sentinel_one_cloud_funnel"]
  4maturity = "production"
  5updated_date = "2025/03/20"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10This rule detects manual execution of the `dracut` command on Linux systems. Dracut is a tool used to generate an
 11initramfs image that is used to boot the system. Attackers may use `dracut` to create a custom initramfs image that
 12includes malicious code or backdoors, allowing them to maintain persistence on the system.
 13"""
 14from = "now-9m"
 15index = [
 16    "endgame-*",
 17    "logs-crowdstrike.fdr*",
 18    "logs-endpoint.events.process*",
 19    "logs-sentinel_one_cloud_funnel.*",
 20]
 21language = "eql"
 22license = "Elastic License v2"
 23name = "Manual Dracut Execution"
 24note = """## Triage and analysis
 25
 26> **Disclaimer**:
 27> 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.
 28
 29### Investigating Manual Dracut Execution
 30
 31Dracut is a utility in Linux systems used to create initramfs images, essential for booting. Adversaries might exploit Dracut to craft malicious initramfs, embedding backdoors for persistence. The detection rule identifies unusual Dracut executions by scrutinizing process origins and excluding legitimate parent processes, flagging potential unauthorized use.
 32
 33### Possible investigation steps
 34
 35- Review the process details to confirm the execution of the dracut command, focusing on the process.name and process.parent.executable fields to identify any unusual parent processes.
 36- Examine the command line arguments used with the dracut process by checking the process.parent.command_line field to understand the context of its execution.
 37- Investigate the user account associated with the dracut execution to determine if it aligns with expected administrative activity or if it indicates potential unauthorized access.
 38- Check the system logs and any related security alerts around the time of the dracut execution to identify any correlated suspicious activities or anomalies.
 39- Assess the system for any changes to the initramfs image or other boot-related files that could indicate tampering or the presence of backdoors.
 40
 41### False positive analysis
 42
 43- Legitimate system updates or kernel installations may trigger the rule. To handle this, users can create exceptions for processes originating from known update paths like /usr/lib/kernel/* or /etc/kernel/install.d/*.
 44- Automated scripts or maintenance tasks that use dracut for legitimate purposes might be flagged. Users should identify these scripts and add their parent process names, such as dracut-install or run-parts, to the exclusion list.
 45- Custom administrative scripts executed by trusted users could be mistaken for suspicious activity. Users can exclude specific command lines or arguments associated with these scripts, such as /usr/bin/dracut-rebuild, to prevent false positives.
 46- Temporary or testing environments where dracut is used for non-malicious testing purposes might trigger alerts. Users can exclude these environments by specifying unique parent process paths or names that are characteristic of the testing setup.
 47
 48### Response and remediation
 49
 50- Immediately isolate the affected system from the network to prevent potential lateral movement or data exfiltration by the adversary.
 51- Terminate any suspicious or unauthorized dracut processes identified on the system to halt any ongoing malicious activity.
 52- Conduct a thorough review of the initramfs images on the affected system to identify and remove any unauthorized or malicious modifications.
 53- Restore the system's initramfs from a known good backup to ensure the integrity of the boot process.
 54- Implement monitoring for any future unauthorized dracut executions by setting up alerts for similar process activities, ensuring quick detection and response.
 55- Escalate the incident to the security operations team for further investigation and to determine if additional systems are affected.
 56- Review and update access controls and permissions to limit the ability to execute dracut to only authorized personnel, reducing the risk of future exploitation."""
 57risk_score = 21
 58rule_id = "834ee026-f9f9-4ec7-b5e0-7fbfe84765f4"
 59setup = """## Setup
 60
 61This rule requires data coming in from Elastic Defend.
 62
 63### Elastic Defend Integration Setup
 64Elastic 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.
 65
 66#### Prerequisite Requirements:
 67- Fleet is required for Elastic Defend.
 68- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
 69
 70#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
 71- Go to the Kibana home page and click "Add integrations".
 72- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
 73- Click "Add Elastic Defend".
 74- Configure the integration name and optionally add a description.
 75- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
 76- 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).
 77- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
 78- 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.
 79For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
 80- Click "Save and Continue".
 81- 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.
 82For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
 83"""
 84severity = "low"
 85tags = [
 86    "Domain: Endpoint",
 87    "OS: Linux",
 88    "Use Case: Threat Detection",
 89    "Tactic: Persistence",
 90    "Tactic: Execution",
 91    "Data Source: Elastic Endgame",
 92    "Data Source: Elastic Defend",
 93    "Data Source: Crowdstrike",
 94    "Data Source: SentinelOne",
 95    "Resources: Investigation Guide",
 96]
 97timestamp_override = "event.ingested"
 98type = "eql"
 99
100query = '''
101process where host.os.type == "linux" and event.type == "start" and
102event.action in ("exec", "exec_event", "start", "ProcessRollup2") and
103process.name == "dracut" and process.parent.executable != null and not (
104  process.parent.executable like~ (
105    "/usr/lib/kernel/*", "/etc/kernel/install.d/*", "/var/lib/dpkg/info/dracut.postinst",
106    "/tmp/newroot/*", "/usr/lib/module-init-tools/*"
107  ) or
108  process.parent.name in (
109    "dracut-install", "dracut", "run-parts", "weak-modules", "mkdumprd", "new-kernel-pkg", "sudo"
110  ) or
111  process.parent.args like~ ("/usr/bin/dracut-rebuild", "/var/tmp/rpm-tmp.*") or
112  process.parent.command_line like~ "/bin/sh -c if command -v mkinitcpio*"
113)
114'''
115
116
117[[rule.threat]]
118framework = "MITRE ATT&CK"
119[[rule.threat.technique]]
120id = "T1542"
121name = "Pre-OS Boot"
122reference = "https://attack.mitre.org/techniques/T1542/"
123
124
125[rule.threat.tactic]
126id = "TA0003"
127name = "Persistence"
128reference = "https://attack.mitre.org/tactics/TA0003/"
129[[rule.threat]]
130framework = "MITRE ATT&CK"
131[[rule.threat.technique]]
132id = "T1059"
133name = "Command and Scripting Interpreter"
134reference = "https://attack.mitre.org/techniques/T1059/"
135[[rule.threat.technique.subtechnique]]
136id = "T1059.004"
137name = "Unix Shell"
138reference = "https://attack.mitre.org/techniques/T1059/004/"
139
140
141
142[rule.threat.tactic]
143id = "TA0002"
144name = "Execution"
145reference = "https://attack.mitre.org/tactics/TA0002/"
...
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.

Dracut is a utility in Linux systems used to create initramfs images, essential for booting. Adversaries might exploit Dracut to craft malicious initramfs, embedding backdoors for persistence. The detection rule identifies unusual Dracut executions by scrutinizing process origins and excluding legitimate parent processes, flagging potential unauthorized use.

  • Review the process details to confirm the execution of the dracut command, focusing on the process.name and process.parent.executable fields to identify any unusual parent processes.
  • Examine the command line arguments used with the dracut process by checking the process.parent.command_line field to understand the context of its execution.
  • Investigate the user account associated with the dracut execution to determine if it aligns with expected administrative activity or if it indicates potential unauthorized access.
  • Check the system logs and any related security alerts around the time of the dracut execution to identify any correlated suspicious activities or anomalies.
  • Assess the system for any changes to the initramfs image or other boot-related files that could indicate tampering or the presence of backdoors.
  • Legitimate system updates or kernel installations may trigger the rule. To handle this, users can create exceptions for processes originating from known update paths like /usr/lib/kernel/* or /etc/kernel/install.d/*.
  • Automated scripts or maintenance tasks that use dracut for legitimate purposes might be flagged. Users should identify these scripts and add their parent process names, such as dracut-install or run-parts, to the exclusion list.
  • Custom administrative scripts executed by trusted users could be mistaken for suspicious activity. Users can exclude specific command lines or arguments associated with these scripts, such as /usr/bin/dracut-rebuild, to prevent false positives.
  • Temporary or testing environments where dracut is used for non-malicious testing purposes might trigger alerts. Users can exclude these environments by specifying unique parent process paths or names that are characteristic of the testing setup.
  • Immediately isolate the affected system from the network to prevent potential lateral movement or data exfiltration by the adversary.
  • Terminate any suspicious or unauthorized dracut processes identified on the system to halt any ongoing malicious activity.
  • Conduct a thorough review of the initramfs images on the affected system to identify and remove any unauthorized or malicious modifications.
  • Restore the system's initramfs from a known good backup to ensure the integrity of the boot process.
  • Implement monitoring for any future unauthorized dracut executions by setting up alerts for similar process activities, ensuring quick detection and response.
  • Escalate the incident to the security operations team for further investigation and to determine if additional systems are affected.
  • Review and update access controls and permissions to limit the ability to execute dracut to only authorized personnel, reducing the risk of future exploitation.

Related rules

to-top