Shell History Files with Embedded Credentials

Detects credentials embedded in shell history files (.bash_history, .zsh_history, ConsoleHost_History.txt) including exported environment variable secrets, mysql command-line passwords, curl basic auth credentials, and sshpass invocations. Mirrors Snaffler rule KeepShellHistoryByName.

Type
regex
Engine
boost_regex
Confidence
high
Confidence justification
High confidence: export of an environment variable whose name contains PASS, TOKEN, SECRET or KEY followed by a non-whitespace value is a canonical shell credential anti-pattern. mysql -p with inline password and sshpass -p are equally unambiguous. curl -u is slightly broader but gated with evidence.
Jurisdictions
global
Regulations
Criminal Code Act 1995 (Cth)
Frameworks
CIS Controls, ISO 27001, NIST CSF
Data categories
credentials, security
Scope
specific
Platform compatibility
Purview: Compatible, GCP DLP: Compatible, Macie: Compatible, Zscaler: Compatible, Palo Alto: Compatible, Netskope: Unsupported

Pattern

export\s+[A-Za-z_]*(?:PASS|TOKEN|SECRET|KEY)[A-Za-z_]*=\S{4,}

Corroborative evidence keywords

export, mysql, curl, sshpass, history, bash_history, zsh_history

Proximity: 300 characters

Should match

Should not match

Known false positives

Collections