Cross-source coverage

T1552.003 / ATT&CK

Unsecured Credentials: Shell History

8 rules across 3 sources.

From MITRE ATT&CK 19.2

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.

Platforms
Linux · macOS · Windows
Telemetry
auditd:SYSCALLauditd:EXECVEmacos:endpointsecuritymacos:unifiedlog

How MITRE says to detect it DET0385

Detect Access and Parsing of .bash_history Files for Credential Harvesting

Linux Analytic 1085

A process outside of interactive shell context reads ~/.bash_history directly (e.g., using cat, less, grep), often shortly after privilege escalation or user switch (su/sudo). This may be followed by credential scanning in memory or file writes to new locations.

  • auditd:SYSCALL open/read access to ~/.bash_history
  • auditd:EXECVE cat|less|grep accessing .bash_history from a non-shell process
  • auditd:SYSCALL write or create file after .bash_history access

macOS Analytic 1086

A process or terminal command outside of standard shell utilities reads the user's.bash_history file. On macOS, unified logs or telemetry tools like EndpointSecurity (ESF) may observe file read APIs or terminal process lineage that shows non-user-initiated access.

  • macos:endpointsecurity open or read syscall to ~/.bash_history
  • macos:unifiedlog non-shell process tree accessing bash history

socfortress/Wazuh-Rules

4 rules
Detection Severity Format
Grep used to extract credentials - suspicious search terms (T1552.003) High Wazuh XML
Pipeline to extract sensitive entries from history files (T1552.003) High Wazuh XML
Reading bash history file - possible credential harvesting (T1552.003) Medium Wazuh XML
Reading sh history file - possible credential harvesting (T1552.003) Medium Wazuh XML

SigmaHQ/sigma

3 rules
Detection Severity Format
Cisco Show Commands Input Medium Sigma
Suspicious History File Operations Medium Sigma
Suspicious History File Operations - Linux Medium Sigma

splunk/security_content

1 rule
Detection Severity Format
Linux Shell History Access Via Command Line Utility Undefined SPL

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.