CVE-2021-3712 Read buffer overruns processing ASN.1 strings

High 7.4 Published Updated

Attackers can trigger read buffer overruns in OpenSSL when processing non-NUL terminated ASN.1 strings, leading to crashes or information disclosure.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2021-3712?

CVE-2021-3712 is a high-severity memory corruption vulnerability in Debian Debian Linux, published on 24 Aug 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

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). Fixed in OpenSSL 1.1.1l (Affected 1.1.1-1.1.1k). Fixed in OpenSSL 1.0.2za (Affected 1.0.2-1.0.2y).

Weakness: CWE-125

Which versions are affected by CVE-2021-3712?

3 open source packages ship an affected version, including openssl-src. It affects 32 products.

PackageAffectedFixed in
openssl-src crates.ioAll versions111.16.0
openssl-src crates.ioAll versions111.16.0
openssl-src crates.ioFrom 0.0.0-0111.16.0
Linux distribution packages (37)
openssl Red Hat:enterprise_linux:7::clientAll versions1:1.0.2k-23.el7_9
openssl-debuginfo Red Hat:enterprise_linux:7::clientAll versions1:1.0.2k-23.el7_9
openssl-devel Red Hat:enterprise_linux:7::clientAll versions1:1.0.2k-23.el7_9
openssl-libs Red Hat:enterprise_linux:7::clientAll versions1:1.0.2k-23.el7_9
openssl-perl Red Hat:enterprise_linux:7::clientAll versions1:1.0.2k-23.el7_9
openssl-static Red Hat:enterprise_linux:7::clientAll versions1:1.0.2k-23.el7_9
openssl-debuginfo Red Hat:enterprise_linux:7::computenodeAll versions1:1.0.2k-23.el7_9
openssl-devel Red Hat:enterprise_linux:7::computenodeAll versions1:1.0.2k-23.el7_9
openssl-perl Red Hat:enterprise_linux:7::computenodeAll versions1:1.0.2k-23.el7_9
openssl-static Red Hat:enterprise_linux:7::computenodeAll versions1:1.0.2k-23.el7_9
openssl Red Hat:enterprise_linux:7::serverAll versions1:1.0.2k-23.el7_9
openssl-debuginfo Red Hat:enterprise_linux:7::serverAll versions1:1.0.2k-23.el7_9
openssl-devel Red Hat:enterprise_linux:7::serverAll versions1:1.0.2k-23.el7_9
openssl-libs Red Hat:enterprise_linux:7::serverAll versions1:1.0.2k-23.el7_9
openssl-perl Red Hat:enterprise_linux:7::serverAll versions1:1.0.2k-23.el7_9
openssl-static Red Hat:enterprise_linux:7::serverAll versions1:1.0.2k-23.el7_9
openssl Red Hat:enterprise_linux:7::workstationAll versions1:1.0.2k-23.el7_9
openssl-debuginfo Red Hat:enterprise_linux:7::workstationAll versions1:1.0.2k-23.el7_9
openssl-devel Red Hat:enterprise_linux:7::workstationAll versions1:1.0.2k-23.el7_9
openssl-libs Red Hat:enterprise_linux:7::workstationAll versions1:1.0.2k-23.el7_9
openssl-perl Red Hat:enterprise_linux:7::workstationAll versions1:1.0.2k-23.el7_9
openssl-static Red Hat:enterprise_linux:7::workstationAll versions1:1.0.2k-23.el7_9
openssl Red Hat:enterprise_linux:8::baseosAll versions1:1.1.1k-5.el8_5
openssl-debuginfo Red Hat:enterprise_linux:8::baseosAll versions1:1.1.1k-5.el8_5
openssl-debugsource Red Hat:enterprise_linux:8::baseosAll versions1:1.1.1k-5.el8_5
openssl-devel Red Hat:enterprise_linux:8::baseosAll versions1:1.1.1k-5.el8_5
openssl-libs Red Hat:enterprise_linux:8::baseosAll versions1:1.1.1k-5.el8_5
openssl-libs-debuginfo Red Hat:enterprise_linux:8::baseosAll versions1:1.1.1k-5.el8_5
openssl-perl Red Hat:enterprise_linux:8::baseosAll versions1:1.1.1k-5.el8_5
openssl Rocky Linux:8All versions1:1.1.1k-5.el8_5
openssl-1_0_0 SUSE:Enterprise Storage 6All versions1.0.2p-3.40.2
openssl-1_0_0 SUSE:Enterprise Storage 6All versions1.0.2p-3.43.1
openssl-1_1 SUSE:Enterprise Storage 6All versions1.1.0i-14.18.1
openssl-1_1 SUSE:Enterprise Storage 6All versions1.1.0i-14.21.2
openssl SUSE:HPE Helion OpenStack 8All versions1.0.2j-60.69.3
openssl SUSE:HPE Helion OpenStack 8All versions1.0.2j-60.72.2
openssl-1_1 SUSE:Linux Enterprise High Performance Computing 15 SP1-ESPOSAll versions1.1.0i-14.18.1

Products include Debian Debian Linux, Mcafee Epolicy Orchestrator, Netapp Clustered Data Ontap, Netapp Clustered Data Ontap Antivirus Connector, Netapp E-Series Santricity Os Controller, Netapp Hci Management Node and 26 more.

How do I fix CVE-2021-3712?

Upgrade openssl-src to 111.16.0 or later.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2021-3712 being exploited?

There is no known exploitation of CVE-2021-3712 in the wild and no public exploit code.

Public exploit code: 1 proofs of concept on GitHub.

All Debian Debian Linux vulnerabilities

Sources

Also known as ALPINE-CVE-2021-3712, AZL-6780, CLEANSTART-2026-AP04707, CLSA-2021-1639681783, DEBIAN-CVE-2021-3712, DLA-2766-1 and 36 more.

Is CVE-2021-3712 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free