EXPLORE
← Back to Explore
sigmalowHunting

Use Of Remove-Item to Delete File - ScriptBlock

PowerShell Remove-Item with -Path to delete a file or a folder with "-Recurse"

MITRE ATT&CK

Detection Query

selection:
  ScriptBlockText|contains:
    - "Remove-Item -Path "
    - "del -Path "
    - "erase -Path "
    - "rd -Path "
    - "ri -Path "
    - "rm -Path "
    - "rmdir -Path "
condition: selection

Author

frack113

Created

2022-01-15

Data Sources

windowsps_script

Platforms

windows

Tags

attack.stealthattack.t1070.004detection.threat-hunting
Raw Content
title: Use Of Remove-Item to Delete File - ScriptBlock
id: b8af5f36-1361-4ebe-9e76-e36128d947bf
status: test
description: PowerShell Remove-Item  with -Path to delete a file or a folder with "-Recurse"
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
author: frack113
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