Usage of weak encryption algorithm on a password (RC4)

Description

Using a weak encryption algorithm like RC4 for passwords increases the risk of security breaches. Encryption, being reversible, is not suitable for password storage because it allows the original password to be retrieved. Passwords should instead be hashed, an irreversible process that transforms them into a fixed-size string of characters.

Remediations

  • Do not use encryption algorithms, including RC4, for password storage. Encryption's reversible nature makes it inappropriate for securing passwords.

  • Do use strong hashing algorithms such as bcrypt or Argon2id for password storage. These algorithms are designed to securely hash passwords, making them much harder to crack.

    BCrypt::Password.create("password_123")
    hasher = Argon2::Password.new()
    hasher.create("password_123")

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

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

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