Golang-fips/openssl: memory leaks in code encrypting and decrypting rsa payloads
Red Hat Ansible Automation Platform 2.4 for RHEL 8 · Red Hat Ansible Automation Platform 2.4 for RHEL 9 · Red Hat Developer Tools · Red Hat Enterprise Linux 8
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| github.com/golang-fips/go Go |
| No fix yet |
| github.com/golang-fips/openssl/v2 Go |
|
|
| github.com/microsoft/go-crypto-openssl Go |
|
|
| github.com/microsoft/go-crypto-openssl/openssl Go |
|
|
Original description
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.
From the CVE record · redhat
References
- access.redhat.com/errata/RHSA-2024:1462
- access.redhat.com/errata/RHSA-2024:1468
- access.redhat.com/errata/RHSA-2024:1472
- access.redhat.com/errata/RHSA-2024:1501
- access.redhat.com/errata/RHSA-2024:1502
- access.redhat.com/errata/RHSA-2024:1561
- access.redhat.com/errata/RHSA-2024:1563
- access.redhat.com/errata/RHSA-2024:1566
- access.redhat.com/errata/RHSA-2024:1567
- access.redhat.com/errata/RHSA-2024:1574
- access.redhat.com/errata/RHSA-2024:1640
- access.redhat.com/errata/RHSA-2024:1644