CVE-2024-1394: Golang-fips/openssl: memory leaks in code encrypting and decrypting rsa payloads
A memory leak flaw was found in Golang in the RSA encrypting/decrypting code, which might lead to a resource exhaustion vulnerability using attacker-controlled inputs. The memory leak happens in github.com/golang-fips/openssl/openssl/rsa.go#L113. The objects leaked are pkey and ctx. That function uses named return parameters to free pkey and ctx if there is an error initializing the context or setting the different properties. All return statements related to error cases follow the "return nil, nil, fail(...)" pattern, meaning that pkey and ctx will be nil inside the deferred function that should free them.
Other sources
A memory leak flaw was found in the RSA encrypting/decrypting code which might lead to a resource exhaustion vulnerability, as it is theoretically exploitable using attacker-controlled inputs. The memory leak happens in github.com/golang-fips/openssl/openssl/rsa.go#L113. The objects leaked are pkey and ctx. That function uses named return parameters to free pkey and ctx if there is an error initializing the context or setting the different properties. Unfortunately, notice that all the return statements related to error cases follow the "return nil, nil, fail(...)" pattern, which means that pkey and ctx will be nil inside the deferred function that should free them.
— Red Hat
Using crafted public RSA keys which are not compliant with SP 800-56B can cause a small memory leak when encrypting and verifying payloads.
An attacker can leverage this flaw to gradually erode available memory to the point where the host crashes for lack of resources. Upon restart the attacker would have to begin again, but nevertheless there is the potential to deny service.
— GitHub
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
go/github.com/microsoft/go-crypto-openssl/opensslto a version that resolves this vulnerability.Fixed in 0.2.9 - Upgrade
Upgrade
go/github.com/golang-fips/openssl/v2to a version that resolves this vulnerability.Fixed in 2.0.1 - Upgrade
Upgrade
redhat/github.com/golang-fips/openssl/v2to a version that resolves this vulnerability.Fixed in 2.0.1 - Upgrade
Upgrade
redhat/github.com/microsoft/go-crypto-openssl/opensslto a version that resolves this vulnerability.Fixed in 0.2.9
Event History
Frequently Asked Questions
What is the severity of CVE-2024-1394?
CVE-2024-1394 has a medium severity rating due to the potential for resource exhaustion from a memory leak.
How do I fix CVE-2024-1394?
To fix CVE-2024-1394, upgrade to version 2.0.1 of github.com/golang-fips/openssl/v2 or version 0.2.9 of github.com/microsoft/go-crypto-openssl.
What causes the memory leak in CVE-2024-1394?
The memory leak in CVE-2024-1394 is caused by flawed RSA encrypting/decrypting code in the Golang libraries.
Which versions are affected by CVE-2024-1394?
CVE-2024-1394 affects versions up to 2.0.0 of github.com/golang-fips/openssl/v2 and 0.2.8 of github.com/microsoft/go-crypto-openssl.
Is CVE-2024-1394 being actively exploited?
As of now, there are no widespread reports indicating active exploitation of CVE-2024-1394.