MITRE ATT&CK T1070.003: Clear Command History
When to use this skill
Use this skill when the task involves T1070.003, Clear Command History, enterprise ATT&CK, TTP mapping, detection engineering, hunting, incident-response enrichment, control validation, or authorized adversary-emulation planning. Treat it as a defensive analysis aid: keep outputs focused on understanding, detecting, mitigating, and safely validating this ATT&CK sub-technique.
Technique context
- ATT&CK domain: enterprise
- ATT&CK ID: T1070.003
- Technique name: Clear Command History
- Type: sub-technique
- ATT&CK URL: https://attack.mitre.org/techniques/T1070/003
- Tactics: stealth
- Platforms: ESXi, Linux, macOS, Network Devices, Windows
- Required permissions: Not specified
- Effective permissions: Not specified
- Defenses bypassed: Not specified
ATT&CK 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).(Citation: US-CERT-TA18-106A) On ESXi servers, command history may be manually removed from the /var/log/shell.log file.(Citation: Broadcom ESXi Shell Audit)
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.(Citation: Microsoft PowerShell Command History)
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.(Citation: Sophos PowerShell command audit)(Citation: Sophos PowerShell Command History Forensics)
Agent workflow
- Clarify scope: identify the system, asset class, log sources, cloud or endpoint platform, and whether the user wants triage, detection, coverage assessment, or safe emulation planning.
- Load bundled resources as needed: use
references/technique-profile.json for structured metadata, references/detection-and-mitigation.md for triage and telemetry guidance, references/known-threat-context.md for ATT&CK relationship context, and templates/ for repeatable outputs.
- Map observations to ATT&CK: compare the user's evidence to the ATT&CK description, tactics, platforms, and known procedure patterns before asserting a match.
- Produce defensive outputs: prioritize hypotheses, telemetry requirements, detection logic ideas, validation steps, containment guidance, and mitigations.
- Preserve uncertainty: distinguish confirmed evidence, plausible indicators, assumptions, and gaps. Recommend what to collect next.
- Stay safe: do not provide malware, credential theft, persistence, evasion, destructive automation, or unauthorized exploitation instructions. For adversary emulation, keep steps bounded to approved lab or control-validation contexts and omit operational abuse details.
Bundled resources
references/technique-profile.json: machine-readable ATT&CK metadata for this technique.
references/detection-and-mitigation.md: detection notes, telemetry checklist, triage questions, mitigation candidates, and false-positive considerations.
references/known-threat-context.md: ATT&CK relationship context with attribution cautions.
templates/detection-brief.md: detection engineering brief template.
templates/hunt-plan.md: threat hunt plan template.
templates/incident-response-note.md: incident response note template.
templates/coverage-assessment.md: ATT&CK coverage assessment template.
scripts/render_brief.py: local helper that renders a Markdown defensive brief from technique-profile.json.
assets/output-schema.json: JSON schema for structured technique analysis outputs.
To generate a quick brief, run python scripts/render_brief.py --output brief.md from inside this skill directory, or adapt the templates directly.
Detection guidance
No ATT&CK detection guidance was present in the source STIX object.
Useful telemetry and data sources
- Not specified in the STIX object.
Mitigations to consider
- Environment Variable Permissions
- Remote Data Storage
- Restrict File and Directory Permissions
Known threat context
Use these examples only as contextual leads, not as proof that an observed event is this technique:
- APT41 (intrusion-set)
- APT5 (intrusion-set)
- Aquatic Panda (intrusion-set)
- Hildegard (malware)
- J-magic (malware)
- Kobalos (malware)
- Lazarus Group (intrusion-set)
- Magic Hound (intrusion-set)
- Medusa Group (intrusion-set)
- TeamTNT (intrusion-set)
- menuPass (intrusion-set)
Recommended output pattern
When responding with this skill, structure the answer as:
- Assessment: whether the evidence supports this ATT&CK mapping and why.
- Evidence: specific indicators, logs, behaviors, and assumptions.
- Detection: telemetry sources, analytic logic, and tuning considerations.
- Response: containment, eradication, recovery, and validation actions.
- Coverage gaps: missing logs, sensors, controls, or environmental details.
- References: include the ATT&CK URL and any user-provided evidence references.
ATT&CK contributors
- Vikas Singh, Sophos
- Emile Kenning, Sophos
- Austin Clark, @c2defense
1---2name: attack-ent-t1070-003-clear-command-history3description: Analyze MITRE ATT&CK T1070.003 Clear Command History in the enterprise matrix. Use for TTP triage, detection engineering, hunting, defensive emulation planning, mitigations, incident response mapping, ATT&CK coverage, or questions mentioning T1070.003, Clear Command History, or enterprise ATT&CK. 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.4license: MITRE ATT&CK Terms of Use apply to ATT&CK-derived content. See h5---67# MITRE ATT&CK T1070.003: Clear Command History89## When to use this skill1011Use this skill when the task involves T1070.003, Clear Command History, enterprise ATT&CK, TTP mapping, detection engineering, hunting, incident-response enrichment, control validation, or authorized adversary-emulation planning. Treat it as a defensive analysis aid: keep outputs focused on understanding, detecting, mitigating, and safely validating this ATT&CK sub-technique.1213## Technique context1415- ATT&CK domain: enterprise16- ATT&CK ID: T1070.00317- Technique name: Clear Command History18- Type: sub-technique19- ATT&CK URL: https://attack.mitre.org/techniques/T1070/00320- Tactics: stealth21- Platforms: ESXi, Linux, macOS, Network Devices, Windows22- Required permissions: Not specified23- Effective permissions: Not specified24- Defenses bypassed: Not specified2526## ATT&CK description2728In 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.2930On 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>. 3132Adversaries may also leverage a [Network Device CLI](https://attack.mitre.org/techniques/T1059/008) on network devices to clear command history data (<code>clear logging</code> and/or <code>clear history</code>).(Citation: US-CERT-TA18-106A) On ESXi servers, command history may be manually removed from the `/var/log/shell.log` file.(Citation: Broadcom ESXi Shell Audit)3334On 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.3536The <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.(Citation: Microsoft PowerShell Command History)3738Adversaries 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.(Citation: Sophos PowerShell command audit)(Citation: Sophos PowerShell Command History Forensics)3940## Agent workflow41421. Clarify scope: identify the system, asset class, log sources, cloud or endpoint platform, and whether the user wants triage, detection, coverage assessment, or safe emulation planning.432. Load bundled resources as needed: use `references/technique-profile.json` for structured metadata, `references/detection-and-mitigation.md` for triage and telemetry guidance, `references/known-threat-context.md` for ATT&CK relationship context, and `templates/` for repeatable outputs.443. Map observations to ATT&CK: compare the user's evidence to the ATT&CK description, tactics, platforms, and known procedure patterns before asserting a match.454. Produce defensive outputs: prioritize hypotheses, telemetry requirements, detection logic ideas, validation steps, containment guidance, and mitigations.465. Preserve uncertainty: distinguish confirmed evidence, plausible indicators, assumptions, and gaps. Recommend what to collect next.476. Stay safe: do not provide malware, credential theft, persistence, evasion, destructive automation, or unauthorized exploitation instructions. For adversary emulation, keep steps bounded to approved lab or control-validation contexts and omit operational abuse details.4849## Bundled resources5051- `references/technique-profile.json`: machine-readable ATT&CK metadata for this technique.52- `references/detection-and-mitigation.md`: detection notes, telemetry checklist, triage questions, mitigation candidates, and false-positive considerations.53- `references/known-threat-context.md`: ATT&CK relationship context with attribution cautions.54- `templates/detection-brief.md`: detection engineering brief template.55- `templates/hunt-plan.md`: threat hunt plan template.56- `templates/incident-response-note.md`: incident response note template.57- `templates/coverage-assessment.md`: ATT&CK coverage assessment template.58- `scripts/render_brief.py`: local helper that renders a Markdown defensive brief from `technique-profile.json`.59- `assets/output-schema.json`: JSON schema for structured technique analysis outputs.6061To generate a quick brief, run `python scripts/render_brief.py --output brief.md` from inside this skill directory, or adapt the templates directly.6263## Detection guidance6465No ATT&CK detection guidance was present in the source STIX object.6667## Useful telemetry and data sources6869- Not specified in the STIX object.7071## Mitigations to consider7273- Environment Variable Permissions74- Remote Data Storage75- Restrict File and Directory Permissions7677## Known threat context7879Use these examples only as contextual leads, not as proof that an observed event is this technique:8081- APT41 (intrusion-set)82- APT5 (intrusion-set)83- Aquatic Panda (intrusion-set)84- Hildegard (malware)85- J-magic (malware)86- Kobalos (malware)87- Lazarus Group (intrusion-set)88- Magic Hound (intrusion-set)89- Medusa Group (intrusion-set)90- TeamTNT (intrusion-set)91- menuPass (intrusion-set)9293## Recommended output pattern9495When responding with this skill, structure the answer as:9697- Assessment: whether the evidence supports this ATT&CK mapping and why.98- Evidence: specific indicators, logs, behaviors, and assumptions.99- Detection: telemetry sources, analytic logic, and tuning considerations.100- Response: containment, eradication, recovery, and validation actions.101- Coverage gaps: missing logs, sensors, controls, or environmental details.102- References: include the ATT&CK URL and any user-provided evidence references.103104## ATT&CK contributors105106- Vikas Singh, Sophos107- Emile Kenning, Sophos108- Austin Clark, @c2defense