Hardcoded password

ID

password

Severity

low

Vendor

-

Family

Password

Description

This detector tries to catch any string assigned to a password-like variable / property. Certain patterns on the variable or property name are checked. An assignment token must also be matched. In addition, the value is analyzed to determine common cases not corresponding to a likely password.

It is recommended to validate the findings from this detector before taking action.

Security

Any hardcoded password can be read by anyone with access to the source code or the configuration file, which could end being publicly accessible.

Examples

password = 's0meth1ngNoTzekr3t';

Mitigation / Fix

  1. Remove the password from the source code or committed configuration file.

  2. Follow your policy for handling leaked secrets, which typically require revoking the secret in the target system(s).

  3. If under a git repository, you may remove unwanted files from the repository history using tools like git filter-repo or BFG Repo-Cleaner. You may follow the procedure listed here for GitHub.

You should consider any sensitive data in commits with secrets as compromised.

Remember that secrets may be removed from history in your projects, but not in other users' cloned or forked repositories.

  1. Check access logs to ensure that the secret was not used by unintended actors during the compromised period.