MITRE ATT&CKsub-technique
T1552.003 Shell History
- Domain
- enterprise
- Tactics
- Credential Access
- Platforms
- Linux, macOS, Windows
- Version
- 2.0
- Created
- 2020-02-04
Description
Adversaries may search the command history on compromised systems for insecurely stored credentials.
On Linux and macOS systems, shells such as Bash and Zsh keep track of the commands users type on the command-line with the "history" utility. Once a user logs out, the history is flushed to the user's history file. For each user, this file resides at the same location: for example, `~/.bash_history` or `~/.zsh_history`. Typically, these files keeps track of the user's last 1000 commands.
On Windows, PowerShell has both a command history that is wiped after the session ends, and one that contains commands used in all sessions and is persistent. The default location for persistent history can be found in `%userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt`, but command history can also be accessed with `Get-History`. Command Prompt (CMD) on Windows does not have persistent history.
Users often type usernames and passwords on the command-line as parameters to programs, which then get saved to this file when they log out. Adversaries can abuse this by looking through the file for potential credentials.
Related
Subtechnique of · MITRE ATT&CK (1)
- T1552 Unsecured Credentials technique
Tactic · MITRE ATT&CK (1)
- TA0006 Credential Access tactic
Referenced by MITRE ATT&CK · mitigates (1)
- M1028 Operating System Configuration mitigation
Referenced by MITRE ATT&CK · uses (5)
Referenced by CAPEC · att&ck technique (1)
- CAPEC-639 Probe System Files attack pattern
Referenced by Compliance · mitigates (5)
- CIS-4.11 Enforce Remote Wipe Capability on Portable End-User Devices CIS Safeguard v8.1
- NIST-CM-6 Configuration Settings NIST 800-53 control
- NIST-CM-7 Least Functionality NIST 800-53 control
- NIST-SC-28 Protection of Information at Rest NIST 800-53 control
- NIST-SI-4 System Monitoring NIST 800-53 control
References
- https://www.slideshare.net/slideshow/external-to-da-the-os-x-way/62021418 External to DA, the OS X Way
- https://michaelkoczwara.medium.com/windows-privilege-escalation-dbb908cce8d4 Medium
- https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_history?view=powershell-7.5 Microsoft about_History