RSA encryption using insecure PKCS#1 v1.5 padding
ID |
vbnet.cryptography.inadequate_padding |
Severity |
high |
Remediation Complexity |
medium |
Remediation Risk |
medium |
Remediation Effort |
medium |
Resource |
Cryptography |
Language |
VB.NET |
Description
RSA encryption is using the outdated PKCS#1 v1.5 padding (fOAEP=False or RSAEncryptionPadding.Pkcs1). PKCS#1 v1.5 is vulnerable to padding-oracle (Bleichenbacher) attacks. Use OAEP padding instead, e.g. RSAEncryptionPadding.OaepSHA256 or Encrypt(data, True).
Rationale
RSA encryption is using the outdated PKCS#1 v1.5 padding (fOAEP=False or RSAEncryptionPadding.Pkcs1). PKCS#1 v1.5 is vulnerable to padding-oracle (Bleichenbacher) attacks. Use OAEP padding instead, e.g. RSAEncryptionPadding.OaepSHA256 or Encrypt(data, True).
The following code illustrates a vulnerable pattern detected by this rule:
Public Function EncryptLegacy(rsa As RSACryptoServiceProvider, data As Byte()) As Byte()
' VULNERABLE: RSA encryption using insecure PKCS#1 v1.5 padding
Return rsa.Encrypt(data, False)
End Function