Usage of weak hashing library on a password (MD5)

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 or any sensitive data. It is no longer considered secure.
  • Do use a strong and recommended hashing library such as Argon2id for hashing passwords. This method enhances security by making it significantly harder for attackers to crack stored passwords.
    const argon2 = require("argon2");
    const hash = await argon2.hash(req.params.password, { type: argon2.argon2id })

References

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

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

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