File or Directory Deletion Command

Last updated 7 days ago on 2026-03-19
Created 3 years ago on 2023-07-13

About

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.
Tags
Domain: EndpointOS: WindowsUse Case: Threat DetectionTactic: Defense EvasionRule Type: BBRData Source: Elastic DefendLanguage: eql
Severity
low
Risk Score
21
MITRE ATT&CK™

Defense Evasion (TA0005)(external, opens in a new tab or window)

License
Elastic License v2(external, opens in a new tab or window)

Definition

Rule Type
Event Correlation Rule
Integration Pack
Prebuilt Security Detection Rules
Index Patterns
logs-endpoint.events.process-*
Related Integrations

endpoint(external, opens in a new tab or window)

Query
text code block:
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"

Install detection rules in Elastic Security

Detect File or Directory Deletion Command in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).