Insecure Cryptography High

Use of weak cryptographic algorithms, including weak ciphers (DES, RC4, Blowfish) and broken hash functions (MD2, MD4, MD5, MDC2, SHA-0, SHA-1, RIPEMD-160). These algorithms are vulnerable to collision or brute-force attacks. Use AES-256-GCM for encryption and SHA-256 or stronger for hashing.

Detector ID
ruby/insecure-cryptography@v1.0
Category
Common Weakness Enumeration (CWE) external icon
Tags
-

Noncompliant example

1require 'openssl'
2
3def cryptography_noncompliant()
4  # Noncompliant: weak block mode
5  OpenSSL::Cipher::AES.new(128, :ecb)
6end

Compliant example

1def cryptography_compliant()
2  # Compliant: strong encryption algorithm
3  OpenSSL::Cipher::AES.new(128, :gcm)
4end