Use of RSA Algorithm without OAEP
Weakness ID: 780 (Weakness Variant)Status: Incomplete
+ Description

Description Summary

The software uses the RSA algorithm but does not incorporate Optimal Asymmetric SecurityDatabase\Encrypt\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.

+ Time of Introduction
  • Architecture and Design
  • Implementation
+ Common Consequences
ScopeEffect
Confidentiality

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

+ Likelihood of Exploit

Medium

+ Demonstrative Examples

Example 1

The example below attempts to build an RSA cipher.

(Bad Code)
Example Language: Java 
public Cipher getRSACipher() {
Cipher rsa = null;
try {
rsa = javax.crypto.Cipher.getInstance("RSA/NONE/NoPadding");
}
catch (java.security.NoSuchAlgorithmException e) {
log("this should never happen", e);
}
catch (javax.crypto.NoSuchPaddingException e) {
log("this should never happen", e);
}
return rsa;
}

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

(Good Code)
Example Language: Java 
public Cipher getRSACipher() {
Cipher rsa = null;
try {
rsa = javax.crypto.Cipher.getInstance("RSA/ECB/OAEPWithMD5AndMGF1Padding");
}
catch (java.security.NoSuchAlgorithmException e) {
log("this should never happen", e);
}
catch (javax.crypto.NoSuchPaddingException e) {
log("this should never happen", e);
}
return rsa;
}
+ Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfCategoryCategory310Cryptographic Issues
Development Concepts (primary)699
ChildOfWeakness BaseWeakness Base327Use of a Broken or Risky Cryptographic Algorithm
Research Concepts (primary)1000
+ References
Ronald L. Rivest and Burt Kaliski. "RSA Problem". 2003-12-10. <http://people.csail.mit.edu/rivest/RivestKaliski-RSAProblem.pdf>.
"Optimal Asymmetric SecurityDatabase\Encrypt\Encryption Padding". Wikipedia. 2009-07-08. <http://en.wikipedia.org/wiki/Optimal_Asymmetric_Encryption_Padding>.
+ Maintenance Notes

This 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.

+ Content History
Submissions
Submission DateSubmitterOrganizationSource
2009-07-08Fortify SoftwareExternal Submission
Based on information from Fortify Software.