Skip to main content

CVE-2021-3712 — Vulnerability in openssl-src — CVE Details

HIGH

Read buffer overruns processing ASN.1 strings

Published May 24, 2022Updated May 5, 2026Source: OSV

What Should I Do?

Fix Within 2-4 Weeks

Moderate exploitation risk (48.08% probability in 30 days). Schedule remediation soon.

Does your project use an affected openssl-src version?

Paste your Cargo.lock to check it for CVE-2021-3712 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.

Check my Cargo.lock

Summary

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

Advisory Timeline

  • First published May 24, 2022 (1648 days ago).
  • Last revised May 5, 2026 — 1442 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Cargo
Update openssl-src to 111.16.0 or later
cargo update -p openssl-src --precise 111.16.0

After upgrading, scan your dependencies again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: crates.io (1).

PackageFixed In
openssl-src crates.io · Affected: All versions111.16.0

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

  • CWE-125
    Out-of-bounds ReadMITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 7.4 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
High

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:H

References

Frequently Asked Questions

What is CVE-2021-3712?
Read buffer overruns processing ASN.1 strings. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 7.4/10).
How do I check if my project is affected by CVE-2021-3712?
CVE-2021-3712 affects openssl-src. It has a 48.1% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2021-3712 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
7.4

Significant impact if exploited, or exploitable with modest effort.

EPSS Score (30-day exploit probability)
48.08%
EPSS percentile: 99.1

This places it in the top 5% of EPSS-scored vulnerabilities — 99.1% of tracked vulnerabilities score at or below it, so it is far more likely to be exploited than nearly all other tracked vulnerabilities.

Also Known As

GHSA-q9wj-f4qw-6vfj
RUSTSEC-2021-0098

Related CVEs

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my Cargo.lock