SOCKS5 Heap Buffer Overflow in curl and libcurl
CVE-2023-38545 is a heap-based buffer overflow in the SOCKS5 proxy handshake implementation of curl and libcurl versions 7.69.0 through 8.3.0 inclusive. When proxy-side hostname resolution is enabled, destination hostnames are limited to 255 bytes. For longer hostnames, curl should resolve the destination locally and send only the resolved address. During a slow SOCKS5 handshake, the hostname-resolution state can become incorrect, causing curl to copy the overlong URL hostname into a heap buffer instead. If the hostname exceeds the available buffer capacity, this causes heap memory corruption. Both libcurl applications and the curl command-line tool can be affected, depending on their proxy and buffer configurations.
What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.
What an attacker gets, and what they’ve been doing with it.
Successful exploitation can corrupt process memory and crash the application, causing denial of service. Depending on memory layout and attacker control, the overflow may also permit arbitrary code execution in the context of the affected process, potentially compromising its data and privileges. Code execution is a potential outcome, not an established consequence of every trigger; practical exploitability depends on the application's configuration and memory conditions.
If you can’t patch tonight, do this now.
Avoid SOCKS5 configurations that delegate destination hostname resolution to the proxy. Do not use CURLPROXY_SOCKS5_HOSTNAME or the socks5h proxy scheme, including in proxy environment variables; use local hostname resolution instead where operationally feasible. Restrict attacker control over destination URLs, particularly overlong hostnames. These measures reduce exposure but do not replace installing the fix.
Patch, then assume compromise.
Upgrade curl and libcurl to version 8.4.0 or later, or install a vendor-supported package containing the backported fix. Update applications and products that bundle vulnerable libcurl copies through their supported vendor updates; updating the system library alone may not replace bundled copies. Product-specific fixes include HCL AppScan Standard 10.4.0 or later and Siemens Desigo-family V8.0 QU2 or later. For affected Siemens V6/V7 installations, follow the vendor procedure to replace CodeMeter Runtime with version 8.40b or later and restart the client/server.
6 exploits validated by Mallory's analysis.
Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.
46 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.