Sigma rule: Clearing Windows Console History
A detection rule from the SigmaHQ repository, shown as its author published it. Dataset version ref-e6702e94e371, updated 2022-12-25T00:00:00.000Z.
Rule
- Title
- Clearing Windows Console History
- Status
- test
- Level
- high
- Author
- Austin Songer @austinsonger
- Date
- 2021-11-25
- Modified
- 2022-12-25
- File
- rules/windows/powershell/powershell_script/posh_ps_clearing_windows_console_history.yml
- Commit
- ccbb0369507f796db0b0ae6854c8a2be471b9d84
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.
Log source
- product
- windows
- category
- ps_script
- definition
- Requirements: Script Block Logging must be enabled
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 selection2bFalse positives (as the rule lists them)
- Unknown
Tags
- attack.stealth
- attack.t1070
- attack.t1070.003
MITRE ATT&CK ids this rule names
References
- https://stefanos.cloud/blog/kb/how-to-clear-the-powershell-command-history/
- https://www.shellhacks.com/clear-history-powershell/
- https://community.sophos.com/sophos-labs/b/blog/posts/powershell-command-history-forensics
Read on 2026-11-03T00:58:21.399Z under licence sigma-drl-1.1@d5f4c36a from https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules/windows/powershell/powershell_script/posh_ps_clearing_windows_console_history.yml
Sources and licences
SigmaHQ
"Clearing Windows Console History" by Austin Songer @austinsonger (SigmaHQ). Rule: https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules/windows/powershell/powershell_script/posh_ps_clearing_windows_console_history.yml.
Licensed under the Detection Rule License (DRL) 1.1: https://github.com/SigmaHQ/Detection-Rule-License
Cite this page
Dragons Eye Ransomware Tracker, "Sigma rule: Clearing Windows Console History",
entity page, dataset version ref-e6702e94e371, updated 2022-12-25T00:00:00.000Z,
https://ransomware-tracker.com/detections/sigma/bde47d4b-9987-405c-94c7-b080410e8ea7 (accessed 2026-11-03).
Underlying source: SigmaHQ rule bde47d4b-9987-405c-94c7-b080410e8ea7, commit ccbb0369507f796db0b0ae6854c8a2be471b9d84.
Pages change. The dataset version identifies the data, but no archive of old versions is kept, so this citation cannot be replayed later.