Use of the insecure ECB cipher mode of operation

ID

vbnet.cryptography.weak_encryption_mode_of_operation

Severity

low

Remediation Complexity

medium

Remediation Risk

medium

Remediation Effort

medium

Resource

Cryptography

Language

VB.NET

Description

The ECB (Electronic Codebook) cipher mode is insecure: identical plaintext blocks encrypt to identical ciphertext blocks, leaking data patterns. Use an authenticated mode instead (AES-GCM / AesGcm or ChaCha20Poly1305), or at least CBC with a random IV.

Rationale

The ECB (Electronic Codebook) cipher mode is insecure: identical plaintext blocks encrypt to identical ciphertext blocks, leaking data patterns. Use an authenticated mode instead (AES-GCM / AesGcm or ChaCha20Poly1305), or at least CBC with a random IV.

The following code illustrates a vulnerable pattern detected by this rule:

Public Sub ConfigureAes()
    Dim aes As Aes = Aes.Create()
    ' VULNERABLE: Use of the insecure ECB cipher mode of operation
    aes.Mode = CipherMode.ECB

Remediation

Follow secure coding practices and review the references below for detailed remediation guidance.

Configuration

This detector does not need any configuration.