A block cipher is used in ECB mode, which shows patterns of the plaintext
What it finds
In ECB mode equal blocks of plaintext give equal blocks of ciphertext, so the structure of the data shows through the encryption. CBC with a random IV, or an authenticated mode such as GCM, hides it.
From the rule's source, ecb_mode.rs.
using System.Security.Cryptography; class Encrypt{ void Setup(Aes aes) { aes.Mode = CipherMode.ECB;tx0 reports: ECB mode shows patterns of the plaintext aes.Mode = CipherMode.CBC; }} Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/csharp:ecb-mode" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/csharp:ecb-mode] reason="..."tx0 explain tx0/csharp:ecb-mode shows the same in the terminal. Found a false positive? Report it.