RSA encryption is set up without OAEP padding
What it finds
RSA with PKCS #1 v1.5 padding is open to padding-oracle attacks, and without padding it is not secure at all. "RSA" alone means RSA/ECB/PKCS1Padding on the JVM. OAEP padding, as in "RSA/ECB/OAEPWithSHA-256AndMGF1Padding", is the current choice.
From the rule's source, rsa_without_oaep.rs.
fun ciphers() { val a = Cipher.getInstance("RSA")tx0 reports: RSA encrypts with RSA without OAEP padding val b = Cipher.getInstance("RSA/ECB/PKCS1Padding")tx0 reports: without OAEP padding val c = Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding") val d = Cipher.getInstance("AES/GCM/NoPadding")} 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:
[rules]
"tx0/kotlin:rsa-without-oaep" = "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/kotlin:rsa-without-oaep] reason="..."tx0 explain tx0/kotlin:rsa-without-oaep shows the same in the terminal. Found a false positive? Report it.