Detectionmediumtest

Clear PowerShell History - PowerShell

Detects keywords that could indicate clearing PowerShell history

Convert In Phoenix Studio

Open this Sigma rule in the converter with the YAML preloaded and ready for backend selection.

Launch
Ilyas Ochkov, Jonhnathan Ribeiro, Daniil Yugoslavskiy, oscd.communityCreated Tue Jan 25Updated Fri Dec 0226b692dc-1722-49b2-b496-a8258aa6371dwindows
Log Source
WindowsPowerShell Script
ProductWindows← raw: windows
CategoryPowerShell Script← raw: ps_script

Definition

Requirements: Script Block Logging must be enabled

Detection Logic
Detection Logic4 selectors
detection:
    selection1a:
        ScriptBlockText|contains:
            - 'del'
            - 'Remove-Item'
            - 'rm'
    selection1b:
        ScriptBlockText|contains: '(Get-PSReadlineOption).HistorySavePath'
    selection_2:
        ScriptBlockText|contains|all:
            - 'Set-PSReadlineOption'
            - '–HistorySaveStyle'  # not sure if the homoglyph –/- is intended, just checking for both
            - 'SaveNothing'
    selection_3:
        ScriptBlockText|contains|all:
            - 'Set-PSReadlineOption'
            - '-HistorySaveStyle'
            - 'SaveNothing'
    condition: 1 of selection_* or all of selection1*
False Positives

Legitimate PowerShell scripts

Related Rules
Derived

dfba4ce1-e0ea-495f-986e-97140f31af2d

Rule not found
Rule Metadata
Rule ID
26b692dc-1722-49b2-b496-a8258aa6371d
Status
test
Level
medium
Type
Detection
Created
Tue Jan 25
Modified
Fri Dec 02
Path
rules/windows/powershell/powershell_script/posh_ps_clear_powershell_history.yml
Raw Tags
attack.defense-evasionattack.t1070.003
View on GitHub