Usage of weak hashing library on a password (SHA-1)

Description

A weak hashing library can lead to data breaches and greater security risk.

Remediations

According to OWASP, SHA1 is considered a weak hashing algorithms and therefore shouldn't be used.

❌ Avoid libraries and algorithms with known weaknesses:

  $encrypted_password = sha1($user->password);

✅ Use stronger encryption algorithms when storing data.

  $encrypted_password = password_hash($user->password);

Associated CWE

OWASP Top 10

Configuration

To skip this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --skip-rule=php_lang_weak_password_hash_sha1

To run only this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --only-rule=php_lang_weak_password_hash_sha1