CVE-2021-4044: Openssl src Invalid Handling Of `X509_verify_cert()` Internal Vulnerability
HIGHCVE-2021-4044 is a HIGH (CVSS 7.5) invalid handling of `x509_verify_cert()` internal vulnerability (CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')) affecting Openssl src libraries in the crates.io ecosystem. The issue involves invalid handling of `x509_verify_cert()` internal errors in libssl. Remediation is available by upgrading affected packages to version 300.0.4.
CVE-2021-4044 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2021-4044
To remediate this vulnerability, upgrade all affected Openssl src dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade openssl-src to 300.0.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for openssl-src
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-4044, inspect your project dependencies for Openssl src:
inspect dependencies for openssl-src
Analyze the terminal output to locate any version of Openssl src in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 300.0.4), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & RFC 5280 Specification
Under RFC 5280 specifications for X.509 certificates, the Name Constraints extension defines a namespace within which all subsequent subject names in a certification path must be located. Constraints apply to various name forms including directory names, IP addresses, rfc822Name (email addresses), and uniformResourceIdentifier (URI) entries. Specifically, during certificate path validation, affected versions of Openssl src failed to properly normalize or enforce boundary checks when domain names contained trailing dot (.) characters. Because domain names with a trailing dot signify fully qualified domain names (FQDNs), this omission allowed non-conforming certificates to be improperly validated as compliant with the defined name constraints.
Source Advisory Statement
CVE-2021-4044 Affected Openssl src Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
openssl-src
|
crates.io |
≥ 300.0.0
< 300.0.4
|
300.0.4
|
References
Frequently Asked Questions
What is CVE-2021-4044?
Which Openssl src versions are affected?
What version fixes CVE-2021-4044?
Is openssl-src affected?
What is the CVSS score of CVE-2021-4044?
What CWE is associated with CVE-2021-4044?
How can I check crates.io dependencies for CVE-2021-4044?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-mmjf-f5jw-w72q",
"modified" : "2022-09-19T21:58:21Z",
"published" : "2021-12-15T00:00:42Z",
"aliases" : [ "CVE-2021-4044" ],
"summary" : "Invalid handling of `X509_verify_cert()` internal errors in libssl",
"details" : "Internally libssl in OpenSSL calls X509_verify_cert() on the client side to verify a certificate supplied by a server. That function may return a negative return value to indicate an internal error (for example out of memory). Such a negative return value is mishandled by OpenSSL and will cause an IO function (such as SSL_connect() or SSL_do_handshake()) to not indicate success and a subsequent call to SSL_get_error() to return the value SSL_ERROR_WANT_RETRY_VERIFY. This return value is only supposed to be returned by OpenSSL if the application has previously called SSL_CTX_set_cert_verify_callback(). Since most applications do not do this the SSL_ERROR_WANT_RETRY_VERIFY return value from SSL_get_error() will be totally unexpected and applications may not behave correctly as a result. The exact behaviour will depend on the application but it could result in crashes, infinite loops or other similar incorrect responses. This issue is made more serious in combination with a separate bug in OpenSSL 3.0 that will cause X509_verify_cert() to indicate an internal error when processing a certificate chain. This will occur where a certificate does not include the Subject Alternative Name extension but where a Certificate Authority has enforced name constraints. This issue can occur even with valid chains. By combining the two issues an attacker could induce incorrect, application dependent behaviour. Fixed in OpenSSL 3.0.1 (Affected 3.0.0).",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "openssl-src"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "300.0.0"
}, {
"fixed" : "300.0.4"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-4044"
}, {
"type" : "WEB",
"url" : "https://git.openssl.org/gitweb/?p=openssl.git%3Ba=commitdiff%3Bh=758754966791c537ea95241438454aa86f91f256"
}, {
"type" : "WEB",
"url" : "https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=758754966791c537ea95241438454aa86f91f256"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2021-0129.html"
}, {
"type" : "WEB",
"url" : "https://security.netapp.com/advisory/ntap-20211229-0003"
}, {
"type" : "WEB",
"url" : "https://www.openssl.org/news/secadv/20211214.txt"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-835" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-06-17T00:01:23Z",
"nvd_published_at" : "2021-12-14T19:15:00Z"
}
}