Use of RSA Algorithm without OAEP

Incomplete Variant
Structure: Simple
Description

The product uses the RSA algorithm but does not incorporate Optimal Asymmetric Encryption Padding (OAEP), which might weaken the encryption.

Extended Description

Padding schemes are often used with cryptographic algorithms to make the plaintext less predictable and complicate attack efforts. The OAEP scheme is often used with RSA to nullify the impact of predictable common text.

Common Consequences 1
Scope: Access Control

Impact: Bypass Protection Mechanism

Without OAEP in RSA encryption, it will take less work for an attacker to decrypt the data or to infer patterns from the ciphertext.

Detection Methods 1
Automated Static AnalysisHigh
Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
Demonstrative Examples 1
The example below attempts to build an RSA cipher.

Code Example:

Bad
Java
java
While the previous code successfully creates an RSA cipher, the cipher does not use padding. The following code creates an RSA cipher using OAEP.

Code Example:

Good
Java
java
References 2
RSA Problem
Ronald L. Rivest and Burt Kaliski
10-12-2003
ID: REF-694
Optimal Asymmetric Encryption Padding
Wikipedia
08-07-2009
ID: REF-695
Likelihood of Exploit

Medium

Modes of Introduction
Implementation
Notes
MaintenanceThis entry could probably have a new parent related to improper padding, however the role of padding in cryptographic algorithms can vary, such as hiding the length of the plaintext and providing additional random bits for the cipher. In general, cryptographic problems in CWE are not well organized and further research is needed.