Operator On The Wire
Join
← Back to Knowledge Base
BLUE TEAM / THREAT HUNT / WINDOWS / EVASION

History Clearing

This note documents detection patterns related to History Clearing within Windows environments.


Direct Indicators

LogEvent IDMeaningForensic ValueNotes
Security4688Process creationCriticalDetects commands targeting shell history, browser history, or PowerShell history files.
Sysmon1Process creationCriticalBest execution source for cleanup tooling and lineage.
Sysmon23File deleteCriticalCaptures deletion of history artifacts.
Sysmon11File createMediumHistory file overwrite or replacement.
PowerShell4104Script block loggingCriticalCaptures history deletion commands.
Sysmon12 / 13Registry create / setMediumBrowser cleanup or shell artifact manipulation.

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
PSReadLine history deletedConsoleHost_history.txt removedCriticalCommon attacker cleanup.
Browser history removed after accessEdge / Chrome DB deletionHighSession concealment clue.
Run dialog history clearedRecentDocs / RunMRU cleanupHighAnti-forensics indicator.
Batch deletion after attack chainCleanup immediately after executionCriticalStrong intent signal.
File replaced with empty versionTimestomped history fileHighPartial anti-forensics.
Selective deletion onlySpecific commands removedHighSkilled operator clue.

Common Tools

ToolUsage
PowerShellRemove-Item history artifacts
cmd.exedel / erase cleanup
reg.exeClear MRU registry entries
browser built-in cleanupClear local traces
custom scriptsMulti-artifact cleanup

Relevant Artifacts

  • Sysmon Event IDs 1, 11, 23, 12, 13
  • Security Event ID 4688
  • PowerShell 4104
  • PowerShell history:
    • %APPDATA%\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
  • Browser history:
    • Chrome History
    • Edge History
  • Registry:
    • RunMRU
    • RecentDocs
  • Prefetch for cleanup tools
  • MFT / USN for deleted artifacts

MITRE ATT&CK References

  • T1070.003 Clear Command History
  • T1070 Indicator Removal on Host

Decision Tree

  1. Which history cleared?

    • PowerShell
    • Browser
    • Run dialog
  2. Which process performed deletion?

    • PowerShell
    • cmd
    • Browser
  3. Timing suspicious?

    • After execution
    • Before disconnect
    • Before log clear
  4. Artifact recoverable?

    • USN
    • MFT
    • Volume shadow
  5. Expand:

    • Adjacent anti-forensics
    • File deletion
    • Registry cleanup
  6. Scope:

    • Single user
    • Multiple profiles
    • Scripted cleanup

Example Detection Templates

KQL

Sysmon
| where EventID == 23
| where TargetFilename has_any ("ConsoleHost_history.txt","History")
| project TimeGenerated, Computer, TargetFilename
Sysmon
| where EventID == 1
| where CommandLine has_any ("Remove-Item","del ","erase ","Clear-History")
| project TimeGenerated, Computer, User, CommandLine

EQL

file where event.code == "23" and file.path like "*ConsoleHost_history.txt*"
sequence by host.name with maxspan=5m
  [ process where process.name in ("powershell.exe","cmd.exe") ]
  [ file where event.code == "23" ]

Sigma

title: History Clearing Detection
id: 3b9d6e44-history-clearing
status: experimental
description: Detects deletion of shell or browser history artifacts
references:
  - https://attack.mitre.org/
author: Vergil
date: 2026-03-07
logsource:
  product: windows
  service: sysmon
detection:
  selection:
    EventID: 23
  keywords:
    TargetFilename|contains:
      - 'ConsoleHost_history.txt'
      - 'History'
  condition: selection and keywords
fields:
  - TargetFilename
falsepositives:
  - User cleanup
level: high
tags:
  - attack.defense_evasion
  - attack.t1070.003

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
Sysmon file delete loggingEnable Event 23CriticalCore artifact visibility
PowerShell loggingPreserve cleanup commandsCriticalStrong source evidence
Shadow copiesRetain deleted artifactsHighRecovery support
Central telemetryPreserve history elsewhereHighReduce local-only blind spots
Registry monitoringWatch MRU cleanupMediumSupplemental visibility