Windows PowerShell ScriptBlock Use of Remove-Item to Delete Files or Folders
Alerts on PowerShell ScriptBlockText containing Remove-Item/del/rm/rd-style -Path deletion commands.
- Product
- windows
- Category
- ps_script
- Author
- frack113 (SigmaHQ), DRL 1.1
- Published
- 2022-01-15
- Updated
- 2026-07-31
ATT&CK techniques
Defense EvasionRecon
Resource Dev
Initial Access
Execution
Persistence
Priv Esc
Defense Evasion
Cred Access
Discovery
Lateral Movement
Collection
C2
Exfiltration
Impact
What it detects
This rule flags PowerShell ScriptBlock content that appears to delete files or folders by matching command aliases and parameters tied to removal operations. Attackers can use Remove-Item (and common aliases like del/erase/rm) with -Path and -Recurse to remove evidence or targeted data. It relies on ScriptBlock logging telemetry that records the executed PowerShell ScriptBlock text.
Reporting behind it
- github.comhttps://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1070.004/T1070.004.md
- docs.microsoft.comhttps://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/Remove-Item?view=powershell-5.1&viewFallbackFrom=powershell-7
- github.comhttps://github.com/SigmaHQ/sigma/blob/master/rules-threat-hunting/windows/powershell/powershell_script/posh_ps_remove_item_path.yml
Changelog
v5- v5Candidate ingested via manual entry.2026-07-31
- v4Candidate ingested via manual entry.2026-07-31
- v3Candidate ingested via manual entry.2026-07-31
- v2Candidate ingested via manual entry.2026-07-31
- v1No changelog recorded for this version.2026-07-30
Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.
title: Windows PowerShell ScriptBlock Use of Remove-Item to Delete Files or Folders
id: 3982e1de-62a5-4ba1-a023-4e701de03476
status: test
description: This rule flags PowerShell ScriptBlock content that appears to delete files or folders by matching command aliases and parameters tied to removal operations. Attackers can use Remove-Item (and common aliases like del/erase/rm) with -Path and -Recurse to remove evidence or targeted data. It relies on ScriptBlock logging telemetry that records the executed PowerShell ScriptBlock text.
references:
- https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1070.004/T1070.004.md
- https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/Remove-Item?view=powershell-5.1&viewFallbackFrom=powershell-7
- https://github.com/SigmaHQ/sigma/blob/master/rules-threat-hunting/windows/powershell/powershell_script/posh_ps_remove_item_path.yml
author: frack113, Huntrule Team
date: 2022-01-15
modified: 2022-03-17
tags:
- attack.stealth
- attack.t1070.004
- detection.threat-hunting
logsource:
product: windows
category: ps_script
definition: "Requirements: Script Block Logging must be enabled"
detection:
selection:
ScriptBlockText|contains:
- "Remove-Item -Path "
- "del -Path "
- "erase -Path "
- "rd -Path "
- "ri -Path "
- "rm -Path "
- "rmdir -Path "
condition: selection
falsepositives:
- Legitimate PowerShell scripts
level: low
license: DRL-1.1
related:
- id: b8af5f36-1361-4ebe-9e76-e36128d947bf
type: derived