CVE-2023-38545
curl: heap based buffer overflow in the SOCKS5 proxy handshake
Severity
ImportantRed Hat Product Security
CVSS 3.1
Review impact separately from score.
Published · October 11, 2023
Updated · October 15, 2026
Description
A heap-based buffer overflow flaw was found in the SOCKS5 proxy handshake in the Curl package. If Curl is unable to resolve the address itself, it passes the hostname to the SOCKS5 proxy. However, the maximum length of the hostname that can be passed is 255 bytes. If the hostname is longer, then Curl switches to the local name resolving and passes the resolved address only to the proxy. The local variable that instructs Curl to "let the host resolve the name" could obtain the wrong value during a slow SOCKS5 handshake, resulting in the too-long hostname being copied to the target buffer instead of the resolved address, which was not the intended behavior.
Statement
This flaw does not affect the versions of curl as shipped with Red Hat Enterprise Linux 6, 7, and 8.
An overflow is only possible in applications that do not set CURLOPT_BUFFERSIZE, or set it smaller than approximately 65kB. Since the curl tool sets CURLOPT_BUFFERSIZE to 100kB by default, it is not vulnerable unless rate limiting was set by the user to a size smaller than 65kB.
Knowledgebase article:
https://access.redhat.com/solutions/7045099
CVSS score applicability
The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.
Mitigation
To avoid this issue, we recommend you do not use CURLPROXY_SOCKS5_HOSTNAME proxies with curl. Also do not set a proxy environment variable to socks5h://
CVSS / CWE
CVSS 3.1 · 8.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
CWE-119 · Improper Restriction of Operations within the Bounds of a Memory Buffer