Hide Forgot
Severity: Moderate ASN.1 strings are represented internally within OpenSSL as an ASN1_STRING structure which contains a buffer holding the string data and a field holding the buffer length. This contrasts with normal C strings which are repesented as a buffer for the string data which is terminated with a NUL (0) byte. Although not a strict requirement, ASN.1 strings that are parsed using OpenSSL's own "d2i" functions (and other similar parsing functions) as well as any string whose value has been set with the ASN1_STRING_set() function will additionally NUL terminate the byte array in the ASN1_STRING structure. However, it is possible for applications to directly construct valid ASN1_STRING structures which do not NUL terminate the byte array by directly setting the "data" and "length" fields in the ASN1_STRING array. This can also happen by using the ASN1_STRING_set0() function. Numerous OpenSSL functions that print ASN.1 data have been found to assume that the ASN1_STRING byte array will be NUL terminated, even though this is not guaranteed for strings that have been directly constructed. Where an application requests an ASN.1 structure to be printed, and where that ASN.1 structure contains ASN1_STRINGs that have been directly constructed by the application without NUL terminating the "data" field, then a read buffer overrun can occur. The same thing can also occur during name constraints processing of certificates (for example if a certificate has been directly constructed by the application instead of loading it via the OpenSSL parsing functions, and the certificate contains non NUL terminated ASN1_STRING structures). It can also occur in the X509_get1_email(), X509_REQ_get1_email() and X509_get1_ocsp() functions. If a malicious actor can cause an application to directly construct an ASN1_STRING and then process it through one of the affected OpenSSL functions then this issue could be hit. This might result in a crash (causing a Denial of Service attack). It could also result in the disclosure of private memory contents (such as private keys, or sensitive plaintext). OpenSSL versions 1.1.1k and below are affected by this issue. Users of these versions should upgrade to OpenSSL 1.1.1l. OpenSSL versions 1.0.2y and below are affected by this issue. However OpenSSL 1.0.2 is out of support and no longer receiving public updates. Premium support customers of OpenSSL 1.0.2 should upgrade to 1.0.2z. Other users should upgrade to 1.1.1l. An initial instance of this issue in the X509_aux_print() function was reported to OpenSSL on 18th July 2021 by Ingo Schwarze. The bugfix was developed by Ingo Schwarze and first publicly released in OpenBSD-current on 10th July 2021 and subsequently in OpenSSL on 20th July 2021 (commit d9d838d). Subsequent analysis by David Benjamin on 17th August 2021 identified more instances of the same bug. Additional analysis was performed by Matt Caswell. Fixes for the additional instances of this issue were developed by Matt Caswell.
Description of the flaw: It was found that several functions internal to openssl were assuming thata given string would be NUL ('\0') terminated. However, it may happen that a given application using openssl libraries is tricked by an attacker into calling these functions with specially crafted, non-NUL terminated strings. This would result in these functions reading past the string's allocated buffer, into the application memory (until a NUL byte is read). This may result in the crash of the application, or, if the attacker is able to retrieve the content read, disclosure of the application's memory. The affected functions are X.509 certificate related, and likely used for logging purpose. The memory disclosure is thus likely to be local only (not sent back to a remote attacker).
Upstream fixes, for the 1.1.1 branch : https://github.com/openssl/openssl/commit/94d23fcff9b2a7a8368dfe52214d5c2569882c11 https://github.com/openssl/openssl/commit/2d0e5d4a4a5d4332325b5e5cea492fad2be633e1 https://github.com/openssl/openssl/commit/bb4d2ed4091408404e18b3326e3df67848ef63d0 https://github.com/openssl/openssl/commit/4de66925203ca99189c842136ec4a623137ea447 https://github.com/openssl/openssl/commit/8393de42498f8be75cf0353f5c9f906a43a748d2 https://github.com/openssl/openssl/commit/23446958685a593d4d9434475734b99138902ed2 https://github.com/openssl/openssl/commit/5f54e57406ca17731b9ade3afd561d3c652e07f2 https://github.com/openssl/openssl/commit/d9d838ddc0ed083fb4c26dd067e71aad7c65ad16
Created mingw-openssl tracking bugs for this issue: Affects: fedora-all [bug 1997221] Created openssl tracking bugs for this issue: Affects: fedora-all [bug 1997219] Created openssl11 tracking bugs for this issue: Affects: epel-7 [bug 1997220]
This issue has been addressed in the following products: Red Hat JBoss Core Services Via RHSA-2021:4613 https://access.redhat.com/errata/RHSA-2021:4613
This issue has been addressed in the following products: JBoss Core Services on RHEL 7 JBoss Core Services for RHEL 8 Via RHSA-2021:4614 https://access.redhat.com/errata/RHSA-2021:4614
This issue has been addressed in the following products: Red Hat Advanced Cluster Management for Kubernetes 2.4 for RHEL 8 Via RHSA-2021:4618 https://access.redhat.com/errata/RHSA-2021:4618
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s): https://access.redhat.com/security/cve/cve-2021-3712
This issue has been addressed in the following products: Red Hat Enterprise Linux 8 Via RHSA-2021:5226 https://access.redhat.com/errata/RHSA-2021:5226
This issue has been addressed in the following products: Red Hat Enterprise Linux 7 Via RHSA-2022:0064 https://access.redhat.com/errata/RHSA-2022:0064
There seems to be a bug in the fix for RHEL7 which crashes Apache or nginx. See bugzilla id 2039993