Skip to content

Use of a broken or risky cryptographic algorithm

Description

AES with ECB mode is deterministic in nature and not suitable for encrypting large amount of repetitive data.

Examples

Insecure Code

javascript
const cipher = crypto.createCipheriv('aes-256-ecb', 'key');

Secure Code

javascript
const cipher = crypto.createCipheriv('aes-256-cbc', 'key', 'iv');

Remediation

Use a secure encryption mode like CBC or GCM instead of ECB.

Rule Details

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