Detectionhightest

Clearing Windows Console History

Identifies when a user attempts to clear console history. An adversary may clear the command history of a compromised account to conceal the actions undertaken during an intrusion.

Open in Detection LabConvert ruleBuild Package
Austin SongerCreated 2021-11-25Updated 2022-12-25bde47d4b-9987-405c-94c7-b080410e8ea7windows
Log Source
WindowsPowerShell Script
ProductWindows← raw: windows
CategoryPowerShell Script← raw: ps_script

Definition

Requirements: Script Block Logging must be enabled

Detection Logic
Detection Logic3 selectors
detection:
    selection1:
        ScriptBlockText|contains: Clear-History
    selection2a:
        ScriptBlockText|contains:
            - Remove-Item
            - rm
    selection2b:
        ScriptBlockText|contains:
            - ConsoleHost_history.txt
            - (Get-PSReadlineOption).HistorySavePath
    condition: selection1 or selection2a and selection2b
False Positives
Unknown

False positive likelihood has not been assessed. Additional context may be needed during triage.

Testing & Validation

Regression Tests

by frack113
Positive Detection Test1 matchevtx

Microsoft-Windows-PowerShell

Rule Metadata
Rule ID
bde47d4b-9987-405c-94c7-b080410e8ea7
Status
test
Level
high
Type
Detection
Created
2021-11-25
Modified
2022-12-25
Path
rules/windows/powershell/powershell_script/posh_ps_clearing_windows_console_history.yml
Raw Tags
attack.stealthattack.t1070attack.t1070.003
View on GitHub