MITRE ATT&CKsub-technique

T1070.003 Clear Command History

Published 2020-01-31 Modified 2026-05-12 Official page ↗
Domain
enterprise
Tactics
Stealth
Platforms
ESXi, Linux, macOS, Network Devices, Windows
Version
2.0
Created
2020-01-31

Description

In addition to clearing system logs, an adversary may clear the command history of a compromised account to conceal the actions undertaken during an intrusion. Various command interpreters keep track of the commands users type in their terminal so that users can retrace what they've done. On Linux and macOS, these command histories can be accessed in a few different ways. While logged in, this command history is tracked in a file pointed to by the environment variable HISTFILE. When a user logs off a system, this information is flushed to a file in the user's home directory called ~/.bash_history. The benefit of this is that it allows users to go back to commands they've used before in different sessions. Adversaries may delete their commands from these logs by manually clearing the history (history -c) or deleting the bash history file rm ~/.bash_history. Adversaries may also leverage a Network Device CLI on network devices to clear command history data (clear logging and/or clear history). On ESXi servers, command history may be manually removed from the `/var/log/shell.log` file. On Windows hosts, PowerShell has two different command history providers: the built-in history and the command history managed by the PSReadLine module. The built-in history only tracks the commands used in the current session. This command history is not available to other sessions and is deleted when the session ends. The PSReadLine command history tracks the commands used in all PowerShell sessions and writes them to a file ($env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt by default). This history file is available to all sessions and contains all past history since the file is not deleted when the session ends. Adversaries may run the PowerShell command Clear-History to flush the entire command history from a current PowerShell session. This, however, will not delete/flush the ConsoleHost_history.txt file. Adversaries may also delete the ConsoleHost_history.txt file or edit its contents to hide PowerShell commands they have run.

Related

Subtechnique of · MITRE ATT&CK (1)

  • T1070 Indicator Removal technique

Tactic · MITRE ATT&CK (1)

Referenced by MITRE ATT&CK · mitigates (3)

  • M1039 Environment Variable Permissions mitigation
  • M1022 Restrict File and Directory Permissions mitigation
  • M1029 Remote Data Storage mitigation

Referenced by MITRE ATT&CK · uses (14)

  • S9051 The Gentlemen Ransomware software (malware)
  • G1051 Medusa Group group
  • G1045 Salt Typhoon group
  • S1203 J-magic software (malware)
  • G1023 APT5 group
  • G0143 Aquatic Panda group
  • G0139 TeamTNT group
  • S0641 Kobalos software (malware)
  • S0601 Hildegard software (malware)
  • G0096 APT41 group
  • G0082 APT38 group
  • G0059 Magic Hound group
  • G0032 Lazarus Group group
  • G0045 menuPass group

Referenced by Compliance · mitigates (11)

  • CIS-3.4 Enforce Data Retention CIS Safeguard v8.1
  • NIST-AC-2 Account Management NIST 800-53 control
  • NIST-AC-3 Access Enforcement NIST 800-53 control
  • NIST-AC-5 Separation of Duties NIST 800-53 control
  • NIST-AC-6 Least Privilege NIST 800-53 control
  • NIST-CA-7 Continuous Monitoring NIST 800-53 control
  • NIST-CM-2 Baseline Configuration NIST 800-53 control
  • NIST-CM-6 Configuration Settings NIST 800-53 control
  • NIST-SI-3 Malicious Code Protection NIST 800-53 control
  • NIST-SI-4 System Monitoring NIST 800-53 control
  • NIST-SI-7 Software, Firmware, and Information Integrity NIST 800-53 control

References