CVE Vulnerabilities

CVE-2021-22901

Use After Free

Published: Jun 11, 2021 | Modified: Mar 27, 2024
CVSS 3.x
8.1
HIGH
Source:
NVD
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS 2.x
6.8 MEDIUM
AV:N/AC:M/Au:N/C:P/I:P/A:P
RedHat/V2
RedHat/V3
8.1 IMPORTANT
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Ubuntu
MEDIUM

curl 7.75.0 through 7.76.1 suffers from a use-after-free vulnerability resulting in already freed memory being used when a TLS 1.3 session ticket arrives over a connection. A malicious server can use this in rare unfortunate circumstances to potentially reach remote code execution in the client. When libcurl at run-time sets up support for TLS 1.3 session tickets on a connection using OpenSSL, it stores pointers to the transfer in-memory object for later retrieval when a session ticket arrives. If the connection is used by multiple transfers (like with a reused HTTP/1.1 connection or multiplexed HTTP/2 connection) that first transfer object might be freed before the new session is established on that connection and then the function will access a memory buffer that might be freed. When using that memory, libcurl might even call a function pointer in the object, making it possible for a remote code execution if the server could somehow manage to get crafted memory content into the correct place in memory.

Weakness

Referencing memory after it has been freed can cause a program to crash, use unexpected values, or execute code.

Affected Software

Name Vendor Start Version End Version
Curl Haxx 7.75.0 (including) 7.76.1 (including)
Curl Ubuntu trusty *
Curl Ubuntu upstream *
Curl Ubuntu xenial *
JBoss Core Services Apache HTTP Server 2.4.37 SP8 RedHat curl *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-0:1-18.el8jbcs *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-apr-0:1.6.3-105.el8jbcs *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-apr-util-0:1.6.1-82.el8jbcs *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-brotli-0:1.0.6-40.el8jbcs *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-curl-0:7.77.0-2.el8jbcs *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-httpd-0:2.4.37-74.el8jbcs *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-jansson-0:2.11-55.el8jbcs *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-mod_cluster-native-0:1.3.16-5.Final_redhat_2.el8jbcs *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-mod_http2-0:1.15.7-17.el8jbcs *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-mod_jk-0:1.2.48-16.redhat_1.el8jbcs *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-mod_md-1:2.0.8-36.el8jbcs *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-mod_security-0:2.9.2-63.GA.el8jbcs *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-nghttp2-0:1.39.2-37.el8jbcs *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-openssl-1:1.1.1g-6.el8jbcs *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-openssl-chil-0:1.0.0-5.el8jbcs *
JBoss Core Services for RHEL 8 RedHat jbcs-httpd24-openssl-pkcs11-0:0.4.10-20.el8jbcs *
JBoss Core Services on RHEL 7 RedHat jbcs-httpd24-0:1-18.jbcs.el7 *
JBoss Core Services on RHEL 7 RedHat jbcs-httpd24-apr-0:1.6.3-105.jbcs.el7 *
JBoss Core Services on RHEL 7 RedHat jbcs-httpd24-apr-util-0:1.6.1-82.jbcs.el7 *
JBoss Core Services on RHEL 7 RedHat jbcs-httpd24-curl-0:7.77.0-2.jbcs.el7 *
JBoss Core Services on RHEL 7 RedHat jbcs-httpd24-httpd-0:2.4.37-74.jbcs.el7 *
JBoss Core Services on RHEL 7 RedHat jbcs-httpd24-jansson-0:2.11-55.jbcs.el7 *
JBoss Core Services on RHEL 7 RedHat jbcs-httpd24-mod_cluster-native-0:1.3.16-5.Final_redhat_2.jbcs.el7 *
JBoss Core Services on RHEL 7 RedHat jbcs-httpd24-mod_http2-0:1.15.7-17.jbcs.el7 *
JBoss Core Services on RHEL 7 RedHat jbcs-httpd24-mod_jk-0:1.2.48-16.redhat_1.jbcs.el7 *
JBoss Core Services on RHEL 7 RedHat jbcs-httpd24-mod_md-1:2.0.8-36.jbcs.el7 *
JBoss Core Services on RHEL 7 RedHat jbcs-httpd24-mod_security-0:2.9.2-63.GA.jbcs.el7 *

Extended Description

The use of previously-freed memory can have any number of adverse consequences, ranging from the corruption of valid data to the execution of arbitrary code, depending on the instantiation and timing of the flaw. The simplest way data corruption may occur involves the system’s reuse of the freed memory. Use-after-free errors have two common and sometimes overlapping causes:

In this scenario, the memory in question is allocated to another pointer validly at some point after it has been freed. The original pointer to the freed memory is used again and points to somewhere within the new allocation. As the data is changed, it corrupts the validly used memory; this induces undefined behavior in the process. If the newly allocated data happens to hold a class, in C++ for example, various function pointers may be scattered within the heap data. If one of these function pointers is overwritten with an address to valid shellcode, execution of arbitrary code can be achieved.

Potential Mitigations

References