Potential Process Self-Deletion

Detects a Linux process deleting its own executable from a relative, temporary, shared-memory, system, web, or user directory. Adversaries may self-delete payloads after execution to remove artifacts and hinder forensic analysis.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2026/11/10"
  3integration = ["endpoint"]
  4maturity = "production"
  5updated_date = "2026/11/26"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Detects a Linux process deleting its own executable from a relative, temporary, shared-memory, system, web, or user
 11directory. Adversaries may self-delete payloads after execution to remove artifacts and hinder forensic analysis.
 12"""
 13from = "now-9m"
 14language = "esql"
 15license = "Elastic License v2"
 16name = "Potential Process Self-Deletion"
 17note = """## Triage and analysis
 18
 19> **Disclaimer**:
 20> 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.
 21
 22### Investigating Potential Process Self-Deletion
 23
 24This rule identifies a file deletion event where the deleted path matches the executable of the process responsible for
 25the deletion. Self-deleting executables are often used by malware to remove payloads after execution and reduce forensic
 26evidence.
 27
 28### Possible investigation steps
 29
 30- Review the process executable, command line, user, parent process, and ancestor chain to determine how the executable
 31  was launched.
 32- Examine the deleted file's hash, path, creation time, and any available file metadata, and search for the same artifact
 33  on other hosts.
 34- Correlate nearby process, file, network, and authentication events to identify payload delivery, persistence,
 35  command-and-control, or lateral movement.
 36- If the process is still running, preserve volatile evidence such as `/proc/<pid>/exe`, memory, open file descriptors,
 37  and active network connections before containment.
 38
 39### False positive analysis
 40
 41- Legitimate installers, updaters, deployment tools, and temporary application launchers may remove their own executable
 42  after completing. Validate the process lineage, user context, file hash, and change records before adding exceptions.
 43- Software running from user-writable or temporary directories can produce this behavior during normal cleanup. Confirm
 44  that the executable and its parent are trusted and that no suspicious follow-on activity occurred.
 45
 46### Response and remediation
 47
 48- Isolate the host when the executable or process lineage is untrusted, and preserve volatile evidence before terminating
 49  the process.
 50- Quarantine related artifacts, remove persistence, and block identified hashes, domains, IP addresses, or download
 51  sources.
 52- Determine the initial access vector, rotate exposed credentials, and hunt for the same executable, hash, or behavior
 53  across the environment.
 54- Reimage or restore the host from a known-good source if system integrity cannot be established.
 55"""
 56risk_score = 47
 57rule_id = "1338f51a-b929-4595-8c93-c5d8e9f62290"
 58setup = """## Setup
 59
 60This rule requires data coming in from Elastic Defend.
 61
 62### Elastic Defend Integration Setup
 63Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic
 64Agent 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
 69  [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
 70
 71#### The following steps should be executed in order to add the Elastic Defend integration on a Linux system:
 72- Go to the Kibana home page and select "Add integrations".
 73- Search for "Elastic Defend" and select the integration.
 74- Select "Add Elastic Defend".
 75- Configure the integration and select a policy that collects all events, such as "Complete EDR (Endpoint Detection and
 76  Response)".
 77- Save the integration and install Elastic Agent on the Linux hosts to monitor.
 78"""
 79severity = "medium"
 80tags = [
 81    "Domain: Endpoint",
 82    "OS: Linux",
 83    "Use Case: Threat Detection",
 84    "Tactic: Defense Evasion",
 85    "Data Source: Elastic Defend",
 86    "Resources: Investigation Guide",
 87    "Rule Type: ES|QL",
 88    "Platform: Linux",
 89]
 90timestamp_override = "event.ingested"
 91type = "esql"
 92
 93query = '''
 94FROM logs-endpoint.events.file-* METADATA _id, _index, _version
 95| WHERE KQL("""host.os.type:linux and event.category:file and event.type:deletion and event.action:deletion""")
 96    AND process.executable IS NOT NULL
 97    AND file.path IS NOT NULL
 98    // Require an exact, case-sensitive match between the deleting process executable and the deleted file.
 99    AND process.executable == file.path
100    AND (
101      process.executable LIKE "./*"
102      OR process.executable LIKE "/tmp/*"
103      OR process.executable LIKE "/var/tmp/*"
104      OR process.executable LIKE "/dev/shm/*"
105      OR process.executable LIKE "/run/*"
106      OR process.executable LIKE "/var/run/*"
107      OR process.executable LIKE "/boot/*"
108      OR process.executable LIKE "/sys/*"
109      OR process.executable LIKE "/lost+found/*"
110      OR process.executable LIKE "/proc/*"
111      OR process.executable LIKE "/var/mail/*"
112      OR process.executable LIKE "/var/www/*"
113      OR process.executable LIKE "/home/*/*"
114      OR process.executable LIKE "/root/*"
115    )
116| KEEP
117    @timestamp,
118    _id,
119    _index,
120    _version,
121    host.id,
122    host.name,
123    user.id,
124    user.name,
125    file.path,
126    file.name,
127    file.hash.sha256,
128    process.entity_id,
129    process.pid,
130    process.name,
131    process.executable,
132    process.parent.entity_id
133'''
134
135
136[[rule.threat]]
137framework = "MITRE ATT&CK"
138[[rule.threat.technique]]
139id = "T1070"
140name = "Indicator Removal"
141reference = "https://attack.mitre.org/techniques/T1070/"
142[[rule.threat.technique.subtechnique]]
143id = "T1070.004"
144name = "File Deletion"
145reference = "https://attack.mitre.org/techniques/T1070/004/"
146
147
148
149[rule.threat.tactic]
150id = "TA0005"
151name = "Defense Evasion"
152reference = "https://attack.mitre.org/tactics/TA0005/"

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 Potential Process Self-Deletion

This rule identifies a file deletion event where the deleted path matches the executable of the process responsible for the deletion. Self-deleting executables are often used by malware to remove payloads after execution and reduce forensic evidence.

Possible investigation steps

  • Review the process executable, command line, user, parent process, and ancestor chain to determine how the executable was launched.
  • Examine the deleted file's hash, path, creation time, and any available file metadata, and search for the same artifact on other hosts.
  • Correlate nearby process, file, network, and authentication events to identify payload delivery, persistence, command-and-control, or lateral movement.
  • If the process is still running, preserve volatile evidence such as /proc/<pid>/exe, memory, open file descriptors, and active network connections before containment.

False positive analysis

  • Legitimate installers, updaters, deployment tools, and temporary application launchers may remove their own executable after completing. Validate the process lineage, user context, file hash, and change records before adding exceptions.
  • Software running from user-writable or temporary directories can produce this behavior during normal cleanup. Confirm that the executable and its parent are trusted and that no suspicious follow-on activity occurred.

Response and remediation

  • Isolate the host when the executable or process lineage is untrusted, and preserve volatile evidence before terminating the process.
  • Quarantine related artifacts, remove persistence, and block identified hashes, domains, IP addresses, or download sources.
  • Determine the initial access vector, rotate exposed credentials, and hunt for the same executable, hash, or behavior across the environment.
  • Reimage or restore the host from a known-good source if system integrity cannot be established.

Related rules

to-top