Skip to content

Use of a broken or risky cryptographic algorithm

Description

Cryptographic algorithms provide many different modes of operation, only some of which provide message integrity. Without message integrity it could be possible for an adversary to attempt to tamper with the ciphertext which could lead to compromising the encryption key. Newer algorithms apply message integrity to validate ciphertext has not been tampered with. Instead of using an algorithm that requires configuring a `CipherMode`, an algorithm that has built-in message integrity should be used.

Examples

Insecure Code

c#
CipherMode.$CIPHER

Secure Code

c#
ChaCha20Poly1305 encryptor = new ChaCha20Poly1305(key);

Remediation

Use an algorithm with built-in message integrity such as `ChaCha20Poly1305` or `AES-256-GCM`.

Rule Details

FieldValue
IDCODE-0443
CategoryCrypto
SeverityMEDIUM
CWECWE-327
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagscryptography, encryption
OWASPA3:2017-Sensitive Data Exposure, A02:2021-Cryptographic Failures