What it is: Use of RSA Algorithm without OAEP (CWE-780) is a cryptographic weakness where encryption is weakened due to the lack of Optimal Asymmetric Encryption Padding (OAEP).
Why it matters: Without OAEP, attackers can exploit vulnerabilities in RSA encryption, leading to data breaches and loss of confidentiality.
How to fix it: Ensure that the RSA algorithm is used with OAEP padding enabled.
TL;DR: Use of RSA Algorithm without OAEP (CWE-780) weakens encryption by omitting Optimal Asymmetric Encryption Padding, making data vulnerable to attacks. Fix it by enabling OAEP in RSA configurations.
| Field | Value |
|---|---|
| CWE ID | CWE-780 |
| OWASP Category | A04:2025 - Cryptographic Failures |
| CAPEC | None known |
| Typical Severity | Medium |
| Affected Technologies | encryption libraries, cryptographic protocols |
| Detection Difficulty | Moderate |
| Last Updated | 2026-07-29 |
What is Use of RSA Algorithm without OAEP?
Use of RSA Algorithm without OAEP (CWE-780) is a type of cryptographic vulnerability that occurs when the RSA algorithm is used for encryption but does not incorporate Optimal Asymmetric Encryption Padding (OAEP). This weakness can weaken the security of encrypted data, making it more susceptible to attacks. As defined by the MITRE Corporation under CWE-780 and classified by the OWASP Foundation under A04:2025 Cryptographic Failures.
Quick Summary
Use of RSA Algorithm without OAEP is a cryptographic vulnerability that weakens encryption by omitting Optimal Asymmetric Encryption Padding (OAEP). This makes encrypted data more susceptible to attacks like chosen ciphertext attacks and padding oracle attacks. Jump to: Overview · How It Works · Business Impact · Attack Scenario · Detection · Fixes
Jump to: Quick Summary · Use of RSA Algorithm without OAEP Overview · How Use of RSA Algorithm without OAEP Works · Business Impact of Use of RSA Algorithm without OAEP · Use of RSA Algorithm without OAEP Attack Scenario · How to Detect Use of RSA Algorithm without OAEP · How to Fix Use of RSA Algorithm without OAEP · Framework-Specific Fixes for Use of RSA Algorithm without OAEP · How to Ask AI to Check Your Code for Use of RSA Algorithm without OAEP · Use of RSA Algorithm without OAEP Best Practices Checklist · Use of RSA Algorithm without OAEP FAQ · Vulnerabilities Related to Use of RSA Algorithm without OAEP · References · Scan Your Own Site
Use of RSA Algorithm without OAEP Overview
What
Use of RSA Algorithm without OAEP is a cryptographic vulnerability that occurs when the RSA algorithm is used for encryption but does not incorporate Optimal Asymmetric Encryption Padding (OAEP).
Why It Matters
Without OAEP, attackers can exploit vulnerabilities in RSA encryption to decrypt data or infer patterns from ciphertext. This significantly weakens the security of encrypted information.
Where It Occurs
This vulnerability occurs when cryptographic libraries or protocols use RSA without specifying OAEP padding.
Who Is Affected
Applications and systems that rely on RSA for encryption are at risk if they do not properly configure OAEP.
Who Is NOT Affected
Systems already using RSA with proper OAEP configuration are not affected by this weakness.
How Use of RSA Algorithm without OAEP Works
Root Cause
The root cause is the absence of Optimal Asymmetric Encryption Padding (OAEP) in RSA encryption configurations, which makes the encrypted data more vulnerable to attacks.
Attack Flow
- An attacker identifies a system using RSA without OAEP.
- The attacker exploits vulnerabilities in the RSA algorithm to perform chosen ciphertext attacks or padding oracle attacks.
- The attacker successfully decrypts sensitive information or infers patterns from the ciphertext.
Prerequisites to Exploit
- The target application must use RSA encryption without specifying OAEP.
- The attacker needs access to encrypted data and knowledge of the RSA configuration.
Vulnerable Code
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5 as Cipher_pkcs1_v1_5
# Generate a public key for demonstration purposes
public_key = RSA.generate(2048).exportKey()
# Encrypt data without OAEP padding
cipher = Cipher_pkcs1_v1_5.new(public_key)
ciphertext = cipher.encrypt(b'sensitive_data')
print(ciphertext)
This code demonstrates the use of RSA encryption without specifying OAEP.
Secure Code
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP as Cipher_pkcs1_oaep
# Generate a public key for demonstration purposes
public_key = RSA.generate(2048).exportKey()
# Encrypt data with OAEP padding
cipher = Cipher_pkcs1_oaep.new(public_key)
ciphertext = cipher.encrypt(b'sensitive_data')
print(ciphertext)
This code demonstrates the use of RSA encryption with proper OAEP configuration.
Business Impact of Use of RSA Algorithm without OAEP
Confidentiality
- Data confidentiality is compromised as attackers can decrypt sensitive information.
- Financial data, personal information, and other confidential records are at risk of being exposed.
Integrity
- Attackers may manipulate ciphertext to alter the integrity of encrypted data.
- This could lead to unauthorized modifications or tampering with critical business data.
Availability
- Systems relying on RSA encryption without OAEP may become unavailable if attackers exploit vulnerabilities to disrupt services.
- Downtime and service interruptions can occur as a result of successful attacks.
Use of RSA Algorithm without OAEP Attack Scenario
- An attacker identifies an application using RSA for encryption but not specifying OAEP padding.
- The attacker sends crafted ciphertexts to the system, attempting to exploit vulnerabilities in the RSA algorithm.
- Upon receiving responses from the server, the attacker infers patterns and successfully decrypts sensitive data.
How to Detect Use of RSA Algorithm without OAEP
Manual Testing
- Review encryption configurations to ensure that RSA is used with proper padding (OAEP).
- Check cryptographic libraries for correct implementation of OAEP in RSA algorithms.
- Verify that all instances of RSA encryption use the appropriate padding mechanisms.
Automated Scanners (SAST / DAST)
- Static analysis tools can identify code snippets where RSA encryption is used without specifying OAEP.
- Dynamic testing can simulate attacks to detect vulnerabilities in real-time configurations.
PenScan Detection
PenScan’s scanner engines, such as ZAP and Wapiti, can flag instances of RSA encryption without proper padding configuration.
False Positive Guidance
A false positive may occur if the code is using a different cryptographic algorithm or if OAEP is correctly implemented but not explicitly specified in comments or documentation.
How to Fix Use of RSA Algorithm without OAEP
- Ensure that all instances of RSA encryption use Optimal Asymmetric Encryption Padding (OAEP).
- Update cryptographic libraries and configurations to include proper padding mechanisms.
- Validate RSA configurations during deployment to ensure compliance with security standards.
Framework-Specific Fixes for Use of RSA Algorithm without OAEP
Python/Django
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP as Cipher_pkcs1_oaep
# Generate a public key for demonstration purposes
public_key = RSA.generate(2048).exportKey()
# Encrypt data with OAEP padding
cipher = Cipher_pkcs1_oaep.new(public_key)
ciphertext = cipher.encrypt(b'sensitive_data')
print(ciphertext)
Java
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import javax.crypto.Cipher;
public class RSAEncryption {
public static void main(String[] args) throws Exception {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
keyGen.initialize(2048);
KeyPair pair = keyGen.generateKeyPair();
Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA-1AndMGF1Padding");
cipher.init(Cipher.ENCRYPT_MODE, pair.getPublic());
byte[] ciphertext = cipher.doFinal("sensitive_data".getBytes());
System.out.println(new String(ciphertext));
}
}
Node.js
const crypto = require('crypto');
const publicKey = '-----BEGIN PUBLIC KEY-----\n...public key...\n-----END PUBLIC KEY-----';
function encryptWithOAEP(plaintext) {
const cipher = crypto.createCipher('RSA-OAEP', publicKey);
let encrypted = cipher.update(plaintext, 'utf8', 'hex');
encrypted += cipher.final('hex');
return encrypted;
}
console.log(encryptWithOAEP('sensitive_data'));
How to Ask AI to Check Your Code for Use of RSA Algorithm without OAEP
Review the following Python code block for potential CWE-780 Use of RSA Algorithm without OAEP vulnerabilities and rewrite it using proper OAEP configuration: [paste code here]
Review the following Python code block for potential CWE-780 Use of RSA Algorithm without OAEP vulnerabilities and rewrite it using proper OAEP configuration: [paste code here]
Use of RSA Algorithm without OAEP Best Practices Checklist
✅ Ensure all instances of RSA encryption use Optimal Asymmetric Encryption Padding (OAEP).
✅ Validate RSA configurations during deployment to ensure compliance with security standards.
✅ Review cryptographic libraries and protocols for correct implementation of OAEP in RSA algorithms.
✅ Update documentation and comments to reflect the proper use of OAEP padding.
Use of RSA Algorithm without OAEP FAQ
How does Use of RSA Algorithm without OAEP weaken encryption?
Without OAEP, the RSA algorithm is more susceptible to attacks like chosen ciphertext attacks and padding oracle attacks, making it easier for attackers to decrypt data or infer patterns from the ciphertext.
Can you show me an example of vulnerable code using RSA without OAEP?
An example would be a cryptographic library call that uses RSA encryption but does not specify OAEP as part of its configuration parameters.
How can I detect Use of RSA Algorithm without OAEP in my application?
Detect this by reviewing your encryption configurations and ensuring that the RSA algorithm is used with OAEP padding enabled.
What are the potential consequences if an attacker exploits Use of RSA Algorithm without OAEP?
An attacker could decrypt sensitive data or manipulate ciphertext to gain unauthorized access, leading to data breaches and loss of confidentiality.
How does OWASP classify this vulnerability?
This is classified under A04:2025 Cryptographic Failures by the OWASP Foundation.
What are some best practices for preventing Use of RSA Algorithm without OAEP?
Always use OAEP padding when implementing RSA encryption to ensure cryptographic integrity and security.
How can I fix Use of RSA Algorithm without OAEP in my existing codebase?
Update your encryption configurations to include OAEP padding when using the RSA algorithm.
Vulnerabilities Related to Use of RSA Algorithm without OAEP
| CWE | Name | Relationship |
|---|---|---|
| CWE-327 | Use of a Broken or Risky Cryptographic Algorithm (ChildOf) |
References
Scan Your Own Site
Manual code review catches what you know to look for. An automated scan catches what you didn’t. Scan your own website using PenScan to find Use of RSA Algorithm without OAEP and other risks before an attacker does.