Apache htpasswd Hashed Credential

Detects Apache htpasswd file entries containing hashed passwords in MD5 ($apr1$), bcrypt ($2y$, $2b$, $2a$), or SHA ({SHA}) formats. Mirrors Snaffler rule KeepConfigByName.

Type
regex
Engine
boost_regex
Confidence
high
Confidence justification
High confidence: the combination of a username and a well-known password hash format marker ($apr1$, $2y$, $2b$, $2a$, {SHA}) is highly specific to htpasswd files. These hash prefixes are not found in other common file formats.
Jurisdictions
global
Regulations
Criminal Code Act 1995 (Cth)
Frameworks
CIS Controls, ISO 27001, NIST CSF
Data categories
credentials
Scope
specific
Platform compatibility
Purview: Compatible, GCP DLP: Compatible, Macie: Compatible, Zscaler: Compatible, Palo Alto: Compatible, Netskope: Unsupported

Pattern

[A-Za-z0-9_.-]{1,64}:(?:\$apr1\$|\$1\$|\$5\$|\$6\$|\$2[aby]\$|\{SHA\})[^\s:]{1,255}

Corroborative evidence keywords

htpasswd, AuthUserFile, AuthType Basic, Require valid-user

Proximity: 300 characters

Should match

Should not match

Known false positives

Collections