Detection rules › Elastic

File or Directory Deletion Command

Status
production
Kind
building block (feeds higher-level correlation rules; not a standalone alert)
Severity
low
Time window
119m
Author
Elastic
Source
github.com/elastic/detection-rules

This rule identifies the execution of commands that can be used to delete files and directories. Adversaries may delete files and directories on a host system, such as logs, browser history, or malware.

MITRE ATT&CK coverage

Event coverage

Rule body elastic

[metadata]
creation_date = "2023/07/13"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
This rule identifies the execution of commands that can be used to delete files and directories. Adversaries may delete
files and directories on a host system, such as logs, browser history, or malware.
"""
from = "now-119m"
index = ["logs-endpoint.events.process-*"]
interval = "60m"
language = "eql"
license = "Elastic License v2"
name = "File or Directory Deletion Command"
risk_score = 21
rule_id = "5919988c-29e1-4908-83aa-1f087a838f63"
severity = "low"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Defense Evasion",
    "Rule Type: BBR",
    "Data Source: Elastic Defend",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
process where host.os.type == "windows" and event.type == "start" and 
(
  ((process.name : "rundll32.exe" or ?process.pe.original_file_name : "RUNDLL32.EXE") and process.args : "*InetCpl.cpl,Clear*") or 
  ((process.name : "reg.exe" or ?process.pe.original_file_name : "reg.exe") and process.args : "delete") or 
  (
    (process.name : "cmd.exe" or ?process.pe.original_file_name : "Cmd.Exe") and
    process.args : ("*rmdir*", "*rm *", "rm", "*del *", "del", "*erase *", "erase") and
    not process.args : (
          "*\\AppData\\Local\\Microsoft\\OneDrive\\*",
          "*\\AppData\\Local\\Temp\\DockerDesktop\\*",
          "*\\AppData\\Local\\Temp\\Report.*",
          "*\\AppData\\Local\\Temp\\*.PackageExtraction"
    )
  ) or
  ((process.name : "powershell.exe" or ?process.pe.original_file_name : "PowerShell.EXE") and
    process.args : ("*rmdir", "rm", "rd", "*Remove-Item*", "del", "*]::Delete(*"))
) and not user.id : "S-1-5-18"
'''


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

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

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

[[rule.threat.technique]]
id = "T1112"
name = "Modify Registry"
reference = "https://attack.mitre.org/techniques/T1112/"

[[rule.threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"

[[rule.threat.technique.subtechnique]]
id = "T1218.011"
name = "Rundll32"
reference = "https://attack.mitre.org/techniques/T1218/011/"

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

Stages and Predicates

Stage 1: process

process where host.os.type == "windows" and event.type == "start" and 
(
  ((process.name : "rundll32.exe" or ?process.pe.original_file_name : "RUNDLL32.EXE") and process.args : "*InetCpl.cpl,Clear*") or 
  ((process.name : "reg.exe" or ?process.pe.original_file_name : "reg.exe") and process.args : "delete") or 
  (
    (process.name : "cmd.exe" or ?process.pe.original_file_name : "Cmd.Exe") and
    process.args : ("*rmdir*", "*rm *", "rm", "*del *", "del", "*erase *", "erase") and
    not process.args : (
          "*\\AppData\\Local\\Microsoft\\OneDrive\\*",
          "*\\AppData\\Local\\Temp\\DockerDesktop\\*",
          "*\\AppData\\Local\\Temp\\Report.*",
          "*\\AppData\\Local\\Temp\\*.PackageExtraction"
    )
  ) or
  ((process.name : "powershell.exe" or ?process.pe.original_file_name : "PowerShell.EXE") and
    process.args : ("*rmdir", "rm", "rd", "*Remove-Item*", "del", "*]::Delete(*"))
) and not user.id : "S-1-5-18"

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
user.ideqS-1-5-18

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
event.typeeq
  • start corpus 606 (elastic 606)
process.argswildcard
  • *InetCpl.cpl,Clear*
  • *Remove-Item*
  • *]::Delete(*
  • *del *
  • *erase *
  • *rm *
  • *rmdir
  • *rmdir*
  • del
  • delete corpus 6 (elastic 6)
  • erase
  • rd
  • rm
process.namewildcard
  • cmd.exe corpus 77 (elastic 48, splunk 29)
  • powershell.exe corpus 104 (elastic 60, splunk 44)
  • reg.exe corpus 20 (elastic 11, splunk 9)
  • rundll32.exe corpus 60 (elastic 34, splunk 26)
process.pe.original_file_namewildcard
  • Cmd.Exe corpus 65 (sigma 43, splunk 17, elastic 5)
  • PowerShell.EXE corpus 120 (sigma 84, splunk 30, elastic 6)
  • RUNDLL32.EXE corpus 62 (sigma 35, splunk 21, elastic 6)
  • reg.exe corpus 42 (sigma 32, splunk 8, elastic 2)