Go Deprecated Encryption Function Use
Description
This vulnerability detector identifies usage of deprecated RSA encryption functions in Go code that use the insecure PKCS#1 v1.5 padding scheme. These functions are vulnerable to padding oracle attacks and have been superseded by more secure alternatives using OAEP padding.
Detection Strategy
• Scans Go source code files that import the 'crypto/rsa' package
• Identifies function calls to deprecated RSA encryption methods: EncryptPKCS1v15, DecryptPKCS1v15, and DecryptPKCS1v15SessionKey
• Reports vulnerabilities when any of these deprecated PKCS#1 v1.5 functions are called, regardless of how the crypto/rsa package is aliased in the import statement
• Triggers on direct function calls using the RSA package alias (e.g., 'rsa.EncryptPKCS1v15()' or custom alias like 'cryptorsa.EncryptPKCS1v15()')
Vulnerable code example
package main
import (
"crypto/rand"
"crypto/rsa"
)
func UnsafeEncrypt(pub *rsa.PublicKey, msg []byte) ([]byte, error) {...✅ Secure code example
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
)
...Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' hacking team, fill out this contact form.