CVE-2023-38545 Memory corruption in curl

High 8.8 Published Updated

A heap-based buffer overflow in curl's SOCKS5 proxy handshake allows attackers to execute arbitrary code or cause denial of service via a long hostname.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2023-38545?

CVE-2023-38545 is a high-severity memory corruption vulnerability in Fedoraproject Fedora, published on 18 Oct 2023. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

This flaw makes curl overflow a heap based buffer in the SOCKS5 proxy handshake.

When curl is asked to pass along the host name to the SOCKS5 proxy to allow that to resolve the address instead of it getting done by curl itself, the maximum length that host name can be is 255 bytes.

If the host name is detected to be longer, curl switches to local name resolving and instead passes on the resolved address only. Due to this bug, the local variable that means "let the host resolve the name" could get the wrong value during a slow SOCKS5 handshake, and contrary to the intention, copy the too long host name to the target buffer instead of copying just the resolved address there.

The target buffer being a heap based buffer, and the host name coming from the URL that curl has been told to operate with.

Weakness: CWE-787

Which versions are affected by CVE-2023-38545?

It affects 13 products.

Linux distribution packages (5)
puppet-agent Red Hat:rhel_satellite_client:6::el6All versions0:7.27.0-1.el6sat
puppet-agent Red Hat:rhel_satellite_client:6::el7All versions0:7.27.0-1.el7sat
puppet-agent Red Hat:rhel_satellite_client:6::el8All versions0:7.27.0-1.el8sat
puppet-agent Red Hat:rhel_satellite_client:6::el9All versions0:7.27.0-1.el9sat
cmake openSUSE:TumbleweedAll versions3.27.8-1.1

Products include Fedoraproject Fedora, Haxx Libcurl, Microsoft Windows 10 1809, Microsoft Windows 10 21h2, Microsoft Windows 10 22h2, Microsoft Windows 11 21h2 and 7 more.

How do I fix CVE-2023-38545?

Upgrade to a fixed version.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2023-38545 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-38545 exists.

Public exploit code: 8 proofs of concept on GitHub.

All Fedoraproject Fedora vulnerabilities

Sources

Also known as ALPINE-CVE-2023-38545, AZL-31288, AZL-31501, AZL-34612, AZL-37886, BELL-CVE-2023-38545 and 11 more.

Is CVE-2023-38545 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free