Skip to content

Use of Broken or Risky Cryptographic Algorithm

Description

The Blowfish encryption algorithm is considered insecure for encrypting files over 4GB in size and should be replaced with more secure alternatives like ChaCha20Poly1305 or AES-GCM.

Examples

Insecure Code

python
cryptography.hazmat.primitives.ciphers.algorithms.Blowfish(...)

Secure Code

python
from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305
key = ChaCha20Poly1305.generate_key()
chacha = ChaCha20Poly1305(key)

Remediation

Replace Blowfish with ChaCha20Poly1305 or AES-GCM for secure encryption.

Rule Details

FieldValue
IDCODE-0125
CategoryCrypto
SeverityMEDIUM
CWECWE-327
ConfidenceHIGH
ImpactMEDIUM
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagsencryption, Blowfish
OWASPA3:2017-Sensitive Data Exposure, A02:2021-Cryptographic Failures