Skip to content
Memory corruption Write-up Advanced

CVE-2023-38545 high severity vulnerability in cURL: everything you need to know

A heap buffer overflow in cURL's SOCKS5 proxy handshake occurs when a hostname longer than 255 bytes is used and a slow handshake causes the local resolution flag to be set incorrectly, leading to the long hostname being copied into a fixed-size buffer. An attacker could cause a denial of service, and potentially memory corruption, though remote code execution is not known to be available.

Merav Bar Follow

Published on wiz.io

The cURL team published version 8.4.0 on October 11, 2023, after announcing that it includes a fix for a high severity vulnerability assigned CVE-2023-38545. This vulnerability is a buffer overflow flaw in the SOCKS5 proxy handshake.

Merav Bar, on wiz.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a logic error where a local variable indicating whether to resolve the hostname locally is set incorrectly during a slow SOCKS5 handshake, causing the full hostname to be copied instead of the resolved address.

Impact

An attacker could cause a denial of service, and potentially memory corruption, but remote code execution is not known to be available and the likelihood of exploitation in the wild is relatively low.

What the attacker needed

Application uses libcurl with a SOCKS5 proxy; request to a malicious URL; hostname longer than 255 bytes; slow SOCKS5 handshake

The fix

The vulnerability was fixed in cURL 8.4.0; mitigations include not using CURLPROXY_SOCKS5_HOSTNAME proxies and not setting a proxy environment variable to socks5h://.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

cURL is a tool for transferring data with URLs, and libcurl is the library version used by many applications. A heap buffer overflow means the program writes more data into a memory area than it can hold, which can crash it or allow an attacker to run their own code. Here, a long hostname is copied into a small buffer because of a mistake during a slow proxy handshake.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by Merav Bar

View all

27 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.