T1070.003: Clear Command History
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).[1] On ESXi servers, command history may be manually removed from the `/var/log/shell.log` file.[2]
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.[3]
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.[4][5]
Analyst context for executives and security teams
Clear Command History matters because it is often an attempt to remove the most useful, human-readable record of what an intruder typed after gaining access. For leaders, the issue is not the history file itself; it is whether incident responders can still reconstruct actions on Linux, macOS, Windows PowerShell, ESXi, and network devices when local command history is deleted or edited.
Executive priority
Treat this as an evidence-preservation and response-readiness gap. If command history is the only practical record of administrator or attacker activity, investigations may lose timeline confidence, audit evidence, and the ability to scope affected systems. Priority should be highest for privileged accounts, network devices, ESXi hosts, and systems where local shell or PowerShell activity is material to business operations or compliance investigations.
Technical view
Validate coverage across the supplied platforms: ESXi, Linux, macOS, Network Devices, and Windows. ATT&CK provides no official detection text, but the relationship to DET0165, Behavioral Detection of Command History Clearing, supports building behavioral analytics around deletion, truncation, or modification of shell and PowerShell history artifacts, unusual changes to history-related environment variables, and network-device CLI activity that clears logs or history. IR teams should not rely on history files alone; compare endpoint, shell, PowerShell, ESXi shell, network-device, and centralized log sources to identify gaps after suspected indicator removal under T1070 Indicator Removal.
Likely telemetry
- File modification, deletion, or truncation events for user shell history files on Linux and macOS, including history locations influenced by HISTFILE
- PowerShell session history activity and access to the PSReadLine ConsoleHost_history.txt file path
- Process or command execution telemetry showing use of shell, PowerShell, ESXi shell, or network-device CLI activity associated with history clearing
- ESXi shell audit or shell log evidence, including /var/log/shell.log where available
- Network device administrative command logs and centralized logging for CLI sessions
Detection direction
- Confirm whether DET0165-style behavioral detection is implemented for command-history clearing rather than simple file-existence checks.
- Tune detections around privileged users, newly created accounts, remote sessions, and systems where administrative shell activity is expected but history artifacts suddenly disappear or shrink.
- Correlate history-clearing signals with broader T1070 Indicator Removal behavior, authentication events, and command execution telemetry to reduce false positives from legitimate maintenance or privacy practices.
- Validate platform-specific blind spots: PowerShell built-in history may disappear when a session ends, while PSReadLine history persists in a file unless deleted or edited; Linux/macOS history behavior depends on HISTFILE and logout behavior; network devices and ESXi require their own logging paths.
- Test whether centralized logs retain enough evidence when local history files are modified or removed.
Mitigation priorities
- Prioritize M1029 Remote Data Storage by forwarding relevant command, shell, device, and security logs to protected off-host storage so local tampering does not erase investigative evidence.
- Apply M1022 Restrict File and Directory Permissions to reduce unnecessary write access to sensitive logging and history-related files where operationally feasible.
- Apply M1039 Environment Variable Permissions to restrict unauthorized changes to shell environment configuration that could alter history behavior.
- Define administrative logging requirements for network devices and ESXi hosts, not only endpoints, because this technique spans infrastructure platforms.
- Document evidence-retention controls for compliance and IR readiness, including who can modify local history artifacts and how tampering is reviewed.
Analyst notes and limits
This technique is a sub-technique of T1070 Indicator Removal and supersedes the revoked T1146 object. Relationships show use by multiple groups and software entries, including Lazarus Group, menuPass, Magic Hound, APT41, TeamTNT, Aquatic Panda, APT5, Medusa Group, Hildegard, Kobalos, and J-magic; use these as threat-intelligence context, not as proof of activity in any local environment.
The official ATT&CK object does not provide a detection section, so detection guidance must be validated against local telemetry and the related DET0165 strategy. The supplied data supports platform scope and artifact examples, but not organization-specific exposure, active exploitation, or guaranteed detection coverage.
Clear Command History
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).[1] On ESXi servers, command history may be manually removed from the `/var/log/shell.log` file.[2]
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.[3]
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.[4][5]
How security teams should use this page
Treat this object as behavior context, not an attribution claim. Validate the related groups, software, data sources, and mitigations against official ATT&CK relationships and your own telemetry before making control-coverage decisions.
Related techniques
This mirrors the MITRE pattern of making group, software, campaign, and technique relationships scannable. Relationship notes come from mirrored ATT&CK relationship text when available.
| Domain | ID | Name | Relationship / procedure |
|---|---|---|---|
| Enterprise | T1070 | Indicator Removal | This object subtechnique of Indicator Removal. |
| Enterprise | T1146 | Clear Command History | Clear Command History revoked by this object. |
Groups, software, and campaigns
G0143: Aquatic Panda
Aquatic Panda is a suspected China-based threat group with a dual mission of intelligence collection and industrial espionage. Active since at least May 2020, Aquatic Panda has primarily targeted entities in the telecommunications, technology, and government sectors.[1]
G1051: Medusa Group
Medusa Group has been active since at least 2021 and was initially operated as a closed ransomware group before evolving into a Ransomware-as-a-Service (RaaS) operation. Some reporting indicates that certain attacks may still be conducted directly by the ransomware’s core developers. Public sources have also referred to the group as “Spearwing” or “Medusa Actors.” [1] [2] Medusa Group employs living-off-the-land techniques, frequently leveraging publicly available tools and common remote management software to conduct operations. The group engages in double extortion tactics, exfiltrating data prior to encryption and threatening to publish stolen information if ransom demands are not met. [3] For initial access, Medusa Group has exploited publicly known vulnerabilities, conducted phishing campaigns, and used credentials or access purchased from Initial Access Brokers (IABs). The group is opportunistic and has targeted a wide range of sectors globally. [4]
G0139: TeamTNT
TeamTNT is a threat group that has primarily targeted cloud and containerized environments. The group as been active since at least October 2019 and has mainly focused its efforts on leveraging cloud and container resources to deploy cryptocurrency miners in victim environments.[1][2][3][4][5][6][7][8][9]
G0045: menuPass
menuPass is a threat group that has been active since at least 2006. Individual members of menuPass are known to have acted in association with the Chinese Ministry of State Security's (MSS) Tianjin State Security Bureau and worked for the Huaying Haitai Science and Technology Development Company.[1][2]
menuPass has targeted healthcare, defense, aerospace, finance, maritime, biotechnology, energy, and government sectors globally, with an emphasis on Japanese organizations. In 2016 and 2017, the group is known to have targeted managed IT service providers (MSPs), manufacturing and mining companies, and a university.[3][4][5][6][7][1][2]
G0059: Magic Hound
Magic Hound is an Iranian-sponsored threat group that conducts long term, resource-intensive cyber espionage operations, likely on behalf of the Islamic Revolutionary Guard Corps. They have targeted European, U.S., and Middle Eastern government and military personnel, academics, journalists, and organizations such as the World Health Organization (WHO), via complex social engineering campaigns since at least 2014.[1][2][3][4][5]
G0032: Lazarus Group
Lazarus Group is a North Korean state-sponsored cyber threat group attributed to the Reconnaissance General Bureau (RGB). [1] [2] Lazarus Group has been active since at least 2009 and is reportedly responsible for the November 2014 destructive wiper attack on Sony Pictures Entertainment, identified by Novetta as part of Operation Blockbuster. Malware used by Lazarus Group correlates to other reported campaigns, including Operation Flame, Operation 1Mission, Operation Troy, DarkSeoul, and Ten Days of Rain.[3]
North Korea’s cyber operations have shown a consistent pattern of adaptation, forming and reorganizing units as national priorities shift. These units frequently share personnel, infrastructure, malware, and tradecraft, making it difficult to attribute specific operations with high confidence. Public reporting often uses “Lazarus Group” as an umbrella term for multiple North Korean cyber operators conducting espionage, destructive attacks, and financially motivated campaigns.[4][5][6]
G1023: APT5
APT5 is a China-based espionage actor that has been active since at least 2007 primarily targeting the telecommunications, aerospace, and defense industries throughout the U.S., Europe, and Asia. APT5 has displayed advanced tradecraft and significant interest in compromising networking devices and their underlying software including through the use of zero-day exploits.[1][2][3][4][5][6]
G0096: APT41
APT41 is a threat group that researchers have assessed as Chinese state-sponsored espionage group that also conducts financially-motivated operations. Active since at least 2012, APT41 has been observed targeting various industries, including but not limited to healthcare, telecom, technology, finance, education, retail and video game industries in 14 countries.[1] Notable behaviors include using a wide range of malware and tools to complete mission objectives. APT41 overlaps at least partially with public reporting on groups including BARIUM and Winnti Group.[2][3]
S1203: J-magic
J-magic is a custom variant of the cd00r backdoor tailored to target Juniper routers that was first observed during the J-magic Campaign in mid-2023. J-magic monitors TCP traffic for five predefined parameters or "magic packets" to be sent by the attackers before activating on compromised devices.[1]
S0641: Kobalos
Kobalos is a multi-platform backdoor that can be used against Linux, FreeBSD, and Solaris. Kobalos has been deployed against high profile targets, including high-performance computers, academic servers, an endpoint security vendor, and a large internet service provider; it has been found in Europe, North America, and Asia. Kobalos was first identified in late 2019.[1][2]
S0601: Hildegard
All related ATT&CK context
Mitigation direction
Object version and sync metadata
The fields below describe the current mirrored snapshot. When Glexia retains multiple ATT&CK source imports, you can open the table to compare the same object across releases (hashes and MITRE timestamps). For MITRE’s own release notes and roadmap, see ATT&CK resources — Updates .
Imported snapshots across ATT&CK releases (1)
| Release | Bundle imported | Object version | Modified | Status | Raw hash |
|---|---|---|---|---|---|
| 19.1 | 2.0 | Current bundle | 80f740a286dd… |
Mirrored ATT&CK source object
The raw object is retained through the mirrored ATT&CK source bundle and object hash. The raw endpoint returns the exact object from the mirrored bundle when available.
External references and citations
MITRE external references are preserved separately from Glexia analysis so citations remain traceable to their original source records.
-
[1]
US-CERT-TA18-106A
US-CERT. (2018, April 20). Alert (TA18-106A) Russian State-Sponsored Cyber Actors Targeting Network Infrastructure Devices. Retrieved October 19, 2020.
Open source URL -
[2]
Broadcom ESXi Shell Audit
Broadcom. (2025, February 20). Auditing ESXi Shell logins and commands. Retrieved March 26, 2025.
Open source URL -
[3]
Microsoft PowerShell Command History
Microsoft. (2020, May 13). About History. Retrieved September 4, 2020.
Open source URL -
[4]
Sophos PowerShell command audit
jak. (2020, June 27). Live Discover - PowerShell command audit. Retrieved August 21, 2020.
Open source URL -
[5]
Sophos PowerShell Command History Forensics
Vikas, S. (2020, August 26). PowerShell Command History Forensics. Retrieved November 17, 2024.
Open source URL -
[6]
mitre-attack T1070.003Open source URL
Source: MITRE ATT&CK®. © 2026 The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. MITRE ATT&CK and ATT&CK are registered trademarks of The MITRE Corporation. Glexia is not affiliated with or endorsed by MITRE.