Detection rules › Elastic

Process Execution Followed by Self-Deletion

Severity
medium
Time window
30s
Sequence by
file.path, host.id, process.entity_id, process.executable
Author
Elastic
Source
github.com/elastic/detection-rules

Detects a process execution followed by immediate self-deletion, a common technique used by adversaries to remove traces of their activity on the system. This pattern is often observed in malware and APT campaigns.

MITRE ATT&CK coverage

Rule body

[metadata]
creation_date = "2026/08/19"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/08/19"

[rule]
author = ["Elastic"]
description = """
Detects a process execution followed by immediate self-deletion, a common technique used by adversaries to
remove traces of their activity on the system. This pattern is often observed in malware and APT campaigns.
"""
from = "now-9m"
index = ["logs-endpoint.events.process*", "logs-endpoint.events.file*"]
language = "eql"
license = "Elastic License v2"
name = "Process Execution Followed by Self-Deletion"
risk_score = 47
rule_id = "702a2046-ea74-4bdc-b8ea-b185471f64c8"
setup = """## Setup

This rule requires data coming in from Elastic Defend.

### Elastic Defend Integration Setup
Elastic 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.

#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).

#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- 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).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- 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.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click "Save and Continue".
- 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.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Defense Evasion",
    "Data Source: Elastic Defend"
]
type = "eql"
query = '''
sequence by process.entity_id, host.id with maxspan=30s
  [process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and 
  process.executable like (
    "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/*", "/var/run/*", "/var/www/*",
    "/proc/*/fd/*", "?memfd:*", "memfd:*"
  )] by process.executable
  [file where host.os.type == "linux" and event.action == "deletion"] by file.path
'''

[[rule.threat]]
framework = "MITRE ATT&CK"

  [rule.threat.tactic]
  name = "Defense Evasion"
  id = "TA0005"
  reference = "https://attack.mitre.org/tactics/TA0005/"

  [[rule.threat.technique]]
  name = "Indicator Removal"
  id = "T1070"
  reference = "https://attack.mitre.org/techniques/T1070/"

    [[rule.threat.technique.subtechnique]]
    name = "File Deletion"
    id = "T1070.004"
    reference = "https://attack.mitre.org/techniques/T1070/004/"

Stages and Predicates

Ordered sequence: each step below must occur in order within 30s, correlated by file.path, host.id, process.entity_id, process.executable.

Stage 1: process

[process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and 
  process.executable like (
    "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/*", "/var/run/*", "/var/www/*",
    "/proc/*/fd/*", "?memfd:*", "memfd:*"
  )] by process.executable

Stage 2: file

[file where host.os.type == "linux" and event.action == "deletion"] by file.path

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • deletion
  • exec
field:"EventType" kind:eq
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.executablewildcard
  • /dev/shm/*
  • /proc/*/fd/*
  • /run/*
  • /tmp/*
  • /var/run/*
  • /var/tmp/*
  • /var/www/*
  • ?memfd:*
  • memfd:*
field:"Image" kind:wildcard