FORENSIA

ATT&CK · T1070.003 · sub-technique

Clear Command History

Tactics: stealth

About

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 <code>HISTFILE</code>. When a user logs off a system, this information is flushed to a file in the user's home directory called <code>~/.bash_history</code>. 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 (<code>history -c</code>) or deleting the bash history file <code>rm ~/.bash_history</code>. Adversaries may also leverage a Network Device CLI on network devices to clear command history data (<code>clear logging</code> and/or <code>clear history</code>). 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 <code>PSReadLine</code> 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 <code>PSReadLine</code> command history tracks the commands used in all PowerShell sessions and writes them to a file (<code>$env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt</code> 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 <code>Clear-History</code> to flush the entire command history from a current PowerShell session. This, however, will not delete/flush the <code>ConsoleHost_history.txt</code> file. Adversaries may also delete the <code>ConsoleHost_history.txt</code> file or edit its contents to hide PowerShell commands they have run.

Platforms: ESXi, Linux, macOS, Network Devices, WindowsParent: T1070 Indicator RemovalMITRE ATT&CK ↗

Used by actors

8 known groups

Software

3 malware/tools implement this

HildegardKobalosJ-magic

Corpus indicators tagged with this technique

43 indicators in the corpus carry T1070.003.

IndicatorTypeFamilySevSrc
cb747c0134f99d5033bac6e966864e2435a2a94244ca8e3f614f4992df93ff10sha256ransomware802
5abe477517f51d81061d2e69a9adebdcda80d36667d0afabe103fda4802d33dbsha256ransomware802
9ddae47ff968343a8c32a5344060257fdc08e2a7bdb9a227c8b3a584ee3c9f1esha256ransomware802
39bd9c888d3e8110c127ba60cc727d2538bf7da2hashransomware801
4200b46a93c6ab059e2b34ce200c4a5bhashransomware802
42bcc743c71a9ea083c1c750a398110582796762hashransomware802
5af1dae21425dda8311a2044209c308525135e1733eeff5dd20649946c6e054csha256ransomware802
f8965fdce668692c3785afa3559159f9a18287bc0d53abb21902895a8ecf221bsha256ransomware802
5b4f59236a9b950bcd5191b35d19125f60cfb9e1a1e1aa2e4f914b6745dde9dfsha256ransomware804
7556ae58c215b8245a43f764f0676c7a8f0fdd1asha1ransomware782
6afc6b04cf73dd461e4a4956365f25c1f1162387sha1ransomware782
96f0dbf52aed0afd43e44500116b04b674f7358esha1ransomware782
1fa071303fb846308571e64727501fb98b1c2be6sha1ransomware782
e7cc7b32d844ec6a2f41f0efbc64a0783afb56e4sha1ransomware782
ab5ad04bb822435e5453706cd86cc001ee555aeesha1ransomware782
68fec379f2ae76c3d2ce913f7be650cea1d06990sha1ransomware784
9321a61a25c7961d9f36852ecaa86f55md5ransomware762
554e699c96b332468f1ae69c1ae81ef9md5ransomware762
73f0a8c3ea794a04e80c32038249f044md5ransomware762
b9986a0f1f1f1a798dc3f0c59a80a1a3md5ransomware762
edb1c480295250dd1a38f3aa1357deaemd5ransomware762
b6b51508ad6f462c45fe102c85d246c8md5ransomware762
5c3b9821fc82a9028cb63b9671950919md5ransomware76110
53c616677bc7e2a0a03127f19166d007md5ransomware76110
5f0b2c6d9f442754258bf4dd841c8341md5ransomware76110
10ca9a4040001560d053b7e7885c1b95md5ransomware76110
608faf58353b65c45ef9833358ac3787md5ransomware76110
adac9984b3cc43d66a0d33079bbec299md5ransomware76110
5761bd63da03686fc480245da7bd1e9fmd5ransomware764
ae0e536766788478263bf448a9381641md5ransomware76110

Showing the top 30 by severity of 43.