RSA encryption uses PKCS#1 v1.5 padding, which is open to padding oracle attacks

tx0/csharp:rsa-pkcs1-encryptionrecommendedwarningsecurity/cryptodepth fastsecurity, cwe-780

What it finds

Encryption with PKCS#1 v1.5 padding can be broken by an attacker who learns whether decryption of chosen ciphertexts succeeds, which servers often reveal. OAEP padding does not have this weakness. The rule reports RSAEncryptionPadding.Pkcs1 and the legacy Encrypt(data, false) of RSACryptoServiceProvider.

From the rule's source, rsa_pkcs1_encryption.rs.

Example from the rule's tests
using System.Security.Cryptography; class Envelope{    byte[] Seal(RSA rsa, byte[] data) => rsa.Encrypt(data, RSAEncryptionPadding.Pkcs1);tx0 reports: RSA encryption with PKCS#1 v1.5 padding     byte[] Safe(RSA rsa, byte[] data) => rsa.Encrypt(data, RSAEncryptionPadding.OaepSHA256);}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:rsa-pkcs1-encryption" = "warning"

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:rsa-pkcs1-encryption] reason="..."

tx0 explain tx0/csharp:rsa-pkcs1-encryption shows the same in the terminal. Found a false positive? Report it.