Usage of weak hashing library on a password (MD5)
- Rule ID: go_lang_weak_password_encryption_md5
- Languages: go
- Source: weak_password_encryption_md5.yml
Description
Using a weak hashing library like MD5 for password storage compromises security. MD5 is outdated and vulnerable, making it easier for attackers to crack passwords and gain unauthorized access.
Remediations
- Do not use MD5 for hashing passwords. This algorithm is no longer considered secure due to its vulnerability to collision and preimage attacks.
md5.Sum([]byte('password')) // unsafe
- Do use stronger hashing algorithms such as SHA-256 for password hashing. These provide enhanced security and resistance against attacks.
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_md5
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_md5