Skip to content

Inadequate Encryption Strength

Description

An authentication cipher mode which provides better confidentiality of the encrypted data should be used instead of Electronic Code Book (ECB) mode, which does not provide good confidentiality. Specifically, ECB mode produces the same output for the same input each time. This allows an attacker to intercept and replay the data.

Examples

Insecure Code

scala
val cipher = Cipher.getInstance("AES/ECB/NoPadding")

Secure Code

scala
val cipher = Cipher.getInstance("AES/CBC/NoPadding")

Remediation

Use a more secure cipher mode like CBC, CFB, or GCM instead of ECB mode.

Rule Details

FieldValue
IDCODE-0020
CategoryCrypto
SeverityMEDIUM
CWECWE-326
ConfidenceHIGH
ImpactMEDIUM
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagsinsecure-cipher-mode, ecb-mode
OWASPN/A