Usage of weak hashing library on a password (Adler-32)

Description

Adler-32 is a weak hashing algorithm that offers minimal security. It is not suitable for protecting passwords against intentional modifications.

Remediations

  • Do not use Adler-32 for hashing passwords. Its simplicity and speed do not compensate for its lack of protection against data tampering.
    myhash = zlib.adler32(user.password) # unsafe
  • Do use stronger hashing algorithms such as SHA-256 to enhance the security of stored passwords.
    myhash = hashlib.sha256(user.password).digest()

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

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

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