VeriKQL by Kaushik Saha

T1070.003 Clear Command History

Stealthon attack.mitre.org

ATT&CK Enterprise 20.0 · 20.1 released, update in review

How MITRE detects it

DET0165 Behavioral Detection of Command History Clearing

AN0467 Linux

Detects adversary behavior clearing command history via `history -c`, deletion or modification of ~/.bash_history, or manipulation of the HISTFILE environment variable post-login.

MITRE log sourceIn Microsoft Sentinel
auditd:SYSCALLexecveNot mapped to Sentinel yet.
auditd:SYSCALLPATHNot mapped to Sentinel yet.

AN0468 macOS

Detects adversary clearing shell history using `history -c` or deleting/altering ~/.zsh_history or ~/.bash_history. Focus on sessions with missing or wiped history.

MITRE log sourceIn Microsoft Sentinel
macos:unifiedlogprocessNot mapped to Sentinel yet.
fs:fsusageunlink, writeNot mapped to Sentinel yet.

AN0469 Windows

Detects PowerShell `Clear-History` invocation or deletion of `ConsoleHost_history.txt` to erase past PowerShell session history.

MITRE log sourceIn Microsoft Sentinel
WinEventLog:PowerShellEventCode=4103, 4104, 4105, 4106
  • Windows event logs (Azure Monitor Agent) → Event
    Event | where EventLog in ("Microsoft-Windows-PowerShell/Operational", "Windows PowerShell") | where EventID in (4103, 4104, 4105, 4106)
  • Windows Forwarded Events → WindowsEvent
    WindowsEvent | where Channel in ("Microsoft-Windows-PowerShell/Operational", "Windows PowerShell") | where EventID in (4103, 4104, 4105, 4106)
WinEventLog:SysmonEventCode=23
  • Windows event logs (Azure Monitor Agent) → Event
    Event | where Source == "Microsoft-Windows-Sysmon" | where EventID in (23)
  • Windows Forwarded Events → WindowsEvent
    WindowsEvent | where Provider == "Microsoft-Windows-Sysmon" | where EventID in (23)

Sysmon has no dedicated Sentinel connector: it is collected as a Windows event log into Event or WindowsEvent.

WinEventLog:SecurityEventCode=4663, 4670, 4656
  • Windows Security Events via AMA → SecurityEvent
    SecurityEvent | where EventID in (4663, 4670, 4656)
  • Security Events via Legacy Agent → SecurityEvent
    SecurityEvent | where EventID in (4663, 4670, 4656)
  • Windows Forwarded Events → WindowsEvent
    WindowsEvent | where Channel == "Security" | where EventID in (4663, 4670, 4656)

The same events land in SecurityEvent (Windows Security Events connectors) or WindowsEvent (Windows Event Forwarding); many built-in rules read SecurityEvent only.

AN0470 ESXi

Detects modification or truncation of `/var/log/shell.log` used to persist ESXi shell command history. Especially suspicious shortly after login or config changes.

MITRE log sourceIn Microsoft Sentinel
esxi:shell/var/log/shell.logNot mapped to Sentinel yet.

AN0471 Network Devices

Detects use of `clear history` or `clear logging` commands on network device CLI to remove past activity logs.

MITRE log sourceIn Microsoft Sentinel
networkdevice:syslogCLI command auditNot mapped to Sentinel yet.

Content Hub rules tagged with it (0)

No Content Hub rule is tagged with this technique.

Rules tagged with this technique (or a sub-technique) in their metadata. Whether one fits your connectors is the coverage view (M2).

In Sigma rules

9 SigmaHQ community rules name it in their tags.

Community rules, not Microsoft's, and not checked by VeriKQL (Sigma is not KQL). From SigmaHQ/sigma at f083329, under the Detection Rule License (DRL) 1.1; each rule is credited to its author.

Mitigations

MITRE ATT&CK® is a registered trademark of The MITRE Corporation. VeriKQL is not affiliated with or endorsed by MITRE. ATT&CK data © The MITRE Corporation, used under its terms of use.