On October 11, 2023  , cURL released Version 8.4.0 of the cURL utility and the libcurl library , addressing a high security impact vulnerability . This vulnerability, identified as CVE-2023-38545  , is a heap-based buffer overflow vulnerability that occurs during the SOCKS5 proxy handshake when curl is configured to forward the hostname to the proxy for address resolution.
If the hostname exceeds 255 bytes   , a bug causes the entire excessively long hostname to be copied to the target buffer instead of just the resolved address , resulting in a heap buffer overflow . Exploiting this vulnerability beyond a Denial-of-Service attack may be challenging , and there are currently no known Remote Code Execution exploits available . The likelihood of malicious exploitation in the wild is considered relatively low at this time .
However, since the vulnerability resides in a library , various applications utilizing libcurl could be affected . The buffer size in libcurl’s heap-based download buffer is typically 16kB but can be changed by the application . The curl tool is not vulnerable by default , as it sets the buffer size to 100kB , unless rate limiting is set to a smaller value .
The vulnerability can be triggered by a slow SOCKS5 handshake and a client using a hostname longer than the download buffer . The vulnerability can be exploited through the use of certain options and environment variables in libcurl and the curl tool . This issue was introduced during the conversion of the SOCKS5 handshake code .
In addition, another vulnerability        , identified as CVE-2023-38546  , allows for cookie injection in libcurl versions 7.9.1 to 8.3.0 . Both vulnerabilities have been patched in version 8.4.0 of libcurl . The severity of these flaws is considered high . The project’s lead developer , Daniel Stenberg , acknowledges their severity but states that porting Curl to a memory-safe language is not currently planned . There are no known workarounds for these vulnerabilities .
The maintainers of curl have disclosed a High severity vulnerability in libcurl versions 7.69.0 up to and including 8.3.0 . This vulnerability is a heap-based buffer overflow within hostnames of SOCKS5 proxies via the command-line flag . Exploitation requires the attacker to control a malicious server , curl to use a SOCKS5 proxy in proxy-resolver mode , and curl to be configured to automatically follow redirects . Applications using libcurl without setting CURLOPTBUFFERSIZE or setting it smaller than 65541 are vulnerable . However, since curl sets CURLOPTBUFFERSIZE to 100kB by default , it is not vulnerable in its default state . The vulnerability is not expected to be widely exploited due to modern memory protections and the need for attackers to find a vulnerable attack surface . It may pose a bigger problem for security devices and appliances using curl . Additionally, curl’s availability on Linux OS could be exploited for privilege escalation in certain attack chains .
CVE-2023-38545 is a buffer overflow vulnerability that affects both libcurl and the curl command line tool . It occurs during a SOCKS5 handshake and can lead to crashes , data corruption , and arbitrary code execution  . This vulnerability only impacts applications using the SOCKS internet protocol . The issue has been addressed in curl version 8.4.0 , which returns an error when a hostname exceeds 255 bytes . Teams are urged to upgrade immediately or implement workarounds if upgrading is not possible .
Although this vulnerability is rated as high , the likelihood of widespread exploitation is considered low due to the limited number of cloud workloads meeting the necessary conditions . It is crucial for affected users to update to version 8.4.0 of libcurl or implement appropriate mitigations to protect against potential attacks. The project’s lead developer’s decision not to port Curl to a memory-safe language may have implications for future vulnerabilities and security measures.