Skip to content

Use of RSA algorithm without OAEP

Description

The software uses the RSA algorithm but does not incorporate Optimal Asymmetric Encryption Padding (OAEP). By not enabling padding, the algorithm may be vulnerable to chosen plaintext attacks.

Examples

Insecure Code

java
javax.crypto.Cipher.getInstance("RSA/ECB/NoPadding");

Secure Code

java
javax.crypto.Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding");

Remediation

Pass `RSA/ECB/OAEPWithSHA-256AndMGF1Padding` to the `Cipher.getInstance` method to enable OAEP mode.

Rule Details

FieldValue
IDCODE-0695
CategoryCrypto
SeverityMEDIUM
CWECWE-780
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityMODERATE
TagsRSA, OAEP, Encryption
OWASPA3:2017-Sensitive Data Exposure, A02:2021-Cryptographic Failures