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

Description

Using a weak hashing library like SHA-1 for passwords increases the risk of data breaches. SHA-1 is vulnerable to collision attacks, where two different inputs can produce the same hash value, compromising data integrity and security.

Remediations

  • Do not use SHA-1 for hashing passwords. This algorithm is no longer considered secure and can make your system vulnerable.
    sha1.Sum([]byte('password')) // unsafe
  • Do opt for stronger hashing algorithms such as SHA-256 to enhance security.
    sha256.Sum256([]byte('string'))

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=go_lang_weak_password_encryption_sha1

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

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