Usage of weak encryption algorithm (RSA)

Description

Using a weak encryption algorithm, specifically 1024-bit RSA, compromises data security. This vulnerability can lead to unauthorized access to sensitive information.

Remediations

  • Do not use 1024-bit RSA for encryption. It is no longer considered secure.
    RSA.generate(1024) # unsafe
  • Do use stronger encryption algorithms to enhance data security. AES (Advanced Encryption Standard) is a recommended choice.
    from Crypto.Cipher import AES

    cipher = AES.new(aes_key, AES.MODE_OCB)
    ciphertext, tag = cipher.encrypt_and_digest(plaintext)

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

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

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