Usage of weak hashing library (MD5)

Description

Using a weak hashing library like MD5 increases the risk of data breaches. MD5 is vulnerable to collision attacks, where two different inputs produce the same output, compromising data integrity and security.

Remediations

  • Do not use MD5 for hashing. It is considered a weak hash algorithm and can compromise data security.
    md5.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_hash_md5

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

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