CVE-2016-5421: Use After Free
A use-after-free vulnerability in libcurl was found. libcurl works with easy handles using the type 'CURL ' that are objects the application creates using curleasyinit(). They are the handles that are all each associated with a single transfer at a time. libcurl also has an internal struct that represents and holds most state that is related to a single connection. An easy handle can hold references to one or many such connection structs depending on the requested operations.
When using libcurl's multi interface, an application performs transfers by adding one or more easy handles to the multi handle and then it can drive all those transfers in parallel.
Due to a flaw, libcurl could leave a pointer to a freed connection struct dangling in an easy handle that was previously added to a multi handle when curlmulticleanup() is called with an easy handle still added to it. This does not seem to cause any notable harm if the handle is then closed properly.
However, if the easy handle would instead get used again with the easy interface and curleasyperform() to do another transfer, it would blindly use the connection struct pointer now pointing to freed memory.
An application could be made to allocate its own fake version of the connect struct, fill in some data and then have the curleasyperform() call do something that clearly was not intended by the original code.
External Reference:
https://curl.haxx.se/docs/adv20160803C.html
Other sources
Use-after-free vulnerability in libcurl before 7.50.1 allows attackers to control which connection is used or possibly have unspecified other impact via unknown vectors.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
redhat/curlto a version that resolves this vulnerability.Fixed in 7.50.1 - Upgrade
Upgrade
libcurlto a version that resolves this vulnerability.Fixed in 7.50.1 - Operational
When using libcurl’s multi interface, ensure an easy handle is no longer added to a multi handle before calling curl_multi_cleanup(); do not reuse an easy handle with curl_easy_perform() after curl_multi_cleanup() has been called while the easy handle is still added to the multi handle.
Event History
Frequently Asked Questions
What is the severity of CVE-2016-5421?
CVE-2016-5421 has a high severity rating due to its potential for attackers to manipulate connections and cause unspecified impacts.
How do I fix CVE-2016-5421?
To fix CVE-2016-5421, update libcurl to version 7.50.1 or later.
Which versions are affected by CVE-2016-5421?
CVE-2016-5421 affects libcurl versions prior to 7.50.1, along with various Linux distributions using older versions.
Can CVE-2016-5421 be exploited remotely?
Yes, CVE-2016-5421 can be exploited remotely through crafted requests that leverage the vulnerability.
What software is impacted by CVE-2016-5421?
CVE-2016-5421 impacts software using affected versions of libcurl, including certain distributions like Ubuntu, Debian, Fedora, and openSUSE.