CVE Vulnerabilities

CVE-2023-0215

Use After Free

Published: Feb 08, 2023 | Modified: May 05, 2025
CVSS 3.x
7.5
HIGH
Source:
NVD
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
CVSS 2.x
RedHat/V2
RedHat/V3
7.5 MODERATE
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Ubuntu
MEDIUM

The public API function BIO_new_NDEF is a helper function used for streaming ASN.1 data via a BIO. It is primarily used internally to OpenSSL to support the SMIME, CMS and PKCS7 streaming capabilities, but may also be called directly by end user applications.

The function receives a BIO from the caller, prepends a new BIO_f_asn1 filter BIO onto the front of it to form a BIO chain, and then returns the new head of the BIO chain to the caller. Under certain conditions, for example if a CMS recipient public key is invalid, the new filter BIO is freed and the function returns a NULL result indicating a failure. However, in this case, the BIO chain is not properly cleaned up and the BIO passed by the caller still retains internal pointers to the previously freed filter BIO. If the caller then goes on to call BIO_pop() on the BIO then a use-after-free will occur. This will most likely result in a crash.

This scenario occurs directly in the internal function B64_write_ASN1() which may cause BIO_new_NDEF() to be called and will subsequently call BIO_pop() on the BIO. This internal function is in turn called by the public API functions PEM_write_bio_ASN1_stream, PEM_write_bio_CMS_stream, PEM_write_bio_PKCS7_stream, SMIME_write_ASN1, SMIME_write_CMS and SMIME_write_PKCS7.

Other public API functions that may be impacted by this include i2d_ASN1_bio_stream, BIO_new_CMS, BIO_new_PKCS7, i2d_CMS_bio_stream and i2d_PKCS7_bio_stream.

The OpenSSL cms and smime command line applications are similarly affected.

Weakness

The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory “belongs” to the code that operates on the new pointer.

Affected Software

Name Vendor Start Version End Version
Openssl Openssl 1.0.2 (including) 1.0.2zg (excluding)
Openssl Openssl 1.1.1 (including) 1.1.1t (excluding)
Openssl Openssl 3.0.0 (including) 3.0.8 (excluding)
JBCS httpd 2.4.51.sp2 RedHat openssl *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-openssl-1:1.1.1k-14.el8jbcs *
JBoss Core Services on RHEL 7 RedHat jbcs-httpd24-openssl-1:1.1.1k-14.el7jbcs *
Red Hat Enterprise Linux 8 RedHat edk2-0:20220126gitbb1bba3d77-4.el8 *
Red Hat Enterprise Linux 8 RedHat openssl-1:1.1.1k-9.el8_7 *
Red Hat Enterprise Linux 8.6 Extended Update Support RedHat edk2-0:20220126gitbb1bba3d77-2.el8_6.1 *
Red Hat Enterprise Linux 8.6 Extended Update Support RedHat openssl-1:1.1.1k-9.el8_6 *
Red Hat Enterprise Linux 9 RedHat openssl-1:3.0.1-47.el9_1 *
Red Hat Enterprise Linux 9 RedHat edk2-0:20221207gitfff6d81270b5-9.el9_2 *
Red Hat Enterprise Linux 9 RedHat openssl-1:3.0.1-47.el9_1 *
Red Hat Enterprise Linux 9.0 Extended Update Support RedHat openssl-1:3.0.1-46.el9_0 *
Red Hat JBoss Web Server 5 RedHat openssl *
Red Hat JBoss Web Server 5.7 on RHEL 7 RedHat jws5-tomcat-native-0:1.2.31-14.redhat_14.el7jws *
Red Hat JBoss Web Server 5.7 on RHEL 8 RedHat jws5-tomcat-native-0:1.2.31-14.redhat_14.el8jws *
Red Hat JBoss Web Server 5.7 on RHEL 9 RedHat jws5-tomcat-native-0:1.2.31-14.redhat_14.el9jws *
Edk2 Ubuntu bionic *
Edk2 Ubuntu focal *
Edk2 Ubuntu kinetic *
Edk2 Ubuntu lunar *
Edk2 Ubuntu trusty *
Edk2 Ubuntu xenial *
Nodejs Ubuntu esm-apps/jammy *
Nodejs Ubuntu jammy *
Nodejs Ubuntu trusty *
Openssl Ubuntu bionic *
Openssl Ubuntu devel *
Openssl Ubuntu esm-infra-legacy/trusty *
Openssl Ubuntu esm-infra/bionic *
Openssl Ubuntu esm-infra/focal *
Openssl Ubuntu esm-infra/xenial *
Openssl Ubuntu fips-preview/jammy *
Openssl Ubuntu fips-updates/bionic *
Openssl Ubuntu fips-updates/focal *
Openssl Ubuntu fips-updates/jammy *
Openssl Ubuntu fips-updates/xenial *
Openssl Ubuntu fips/bionic *
Openssl Ubuntu fips/focal *
Openssl Ubuntu fips/xenial *
Openssl Ubuntu focal *
Openssl Ubuntu jammy *
Openssl Ubuntu kinetic *
Openssl Ubuntu lunar *
Openssl Ubuntu mantic *
Openssl Ubuntu noble *
Openssl Ubuntu oracular *
Openssl Ubuntu plucky *
Openssl Ubuntu trusty *
Openssl Ubuntu trusty/esm *
Openssl Ubuntu upstream *
Openssl Ubuntu xenial *
Openssl1.0 Ubuntu bionic *
Openssl1.0 Ubuntu esm-infra/bionic *

Potential Mitigations

References