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
| Field | Value |
|---|---|
| ID | CODE-0695 |
| Category | Crypto |
| Severity | MEDIUM |
| CWE | CWE-780 |
| Confidence | HIGH |
| Impact | HIGH |
| Likelihood | MEDIUM |
| Exploitability | MODERATE |
| Tags | RSA, OAEP, Encryption |
| OWASP | A3:2017-Sensitive Data Exposure, A02:2021-Cryptographic Failures |