Usage of weak hashing library on a password (CRC32)
- Rule ID: python_lang_weak_password_hash_crc32
- Languages: python
- Source: weak_password_hash_crc32.yml
Description
The use of CRC32 for password hashing is insecure. CRC32 is designed for error-checking and not for security purposes, making it vulnerable to intentional data tampering.
Remediations
- Do not use CRC32 for password hashing. It is not secure against intentional data modifications.
myhash = zlib.crc32(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_crc32
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_crc32