curl SOCKS5 Heap Overflow Vulnerability (CVC-2023-38545) Notification

curl SOCKS5 Heap Overflow Vulnerability (CVC-2023-38545) Notification

October 12, 2023 | NSFOCUS

Overview

Recently, NSFOCUS monitored curl’s official security announcement, which fixed the SOCKS5 heap buffer overflow vulnerability (CVE-2023-38545) and cookie injection vulnerability (CVE-2023-38546). The details of the vulnerability have been made public. Affected users should upgrade curl as soon as possible.

SOCKS5 Heap Buffer Overflow Vulnerability (CVS 2023-38545)

When curl is required to pass the host name to the SOCKS5 agent for address resolution, if the host name exceeds 255 bytes, curl will experience a heap based buffer overflow. Due to the slow SOCKS5 grip, a local variable may generate incorrect values, resulting in curl not copying resolved addresses, but copying overly long host names to the destination buffer. This vulnerability affects both the command-line tool curl and the dependent library libcurl.

Cookie injection vulnerability (CVS 2023-38546)

Under specific conditions, attackers can insert Cookie into the program. This vulnerability is due to the use of curl_ easy_dupandle when copying “easy handles”, the Cookie enable state is copied, but the specific Cookies are not copied. This may cause the copied handle to load cookies from a file with the suffix ‘none’, and further leads to Cookie injection. This situation requires multiple conditions to be met, thus the vulnerability risk is lower and only affecting libcurl.

Reference link:

https://curl.se/docs/CVE-2023-38545.html

https://curl.se/docs/CVE-2023-38546.html

Scope of Impact

Affected version

CVS 2023-38545

  • 7.69.0<=libcurl<=8.3.0

CVE-2023-38546

  • 7.9.1<=libcurl<=8.3.0

Note: Operating systems using libcurl and components derived from cURL and libcurl are also affected by the aforementioned vulnerabilities

Unaffected version

CVE-2023-38545/CVE-2023-38546

  • libcurl>=8.4.0
  • libcurl<7.69.0

Mitigation

Official upgrade

At present, the official has released a new version to fix the above vulnerabilities. It is recommended that affected users update and upgrade in a timely manner to protect:

https://curl.se/download.html

https://github.com/curl/curl/commit/fb4415d8aee6c1

Temporary mitigation measures

1. Do not enable proxy in CURLPROXY_ SOCKS5_ HOSTNAME setting;

2. Do not set the proxy environment variable to socks5h://

Statement

This advisory is only used to describe a potential risk. NSFOCUS does not provide any commitment or promise on this advisory. NSFOCUS and the author will not bear any liability for any direct and/or indirect consequences and losses caused by transmitting and/or using this advisory. NSFOCUS reserves all the rights to modify and interpret this advisory. Please include this statement paragraph when reproducing or transferring this advisory. Do not modify this advisory, add/delete any information to/from it, or use this advisory for commercial purposes without permission from NSFOCUS.

About NSFOCUS

NSFOCUS, Inc., a global network and cyber security leader, protects enterprises and carriers from advanced cyberattacks. The company’s Intelligent Hybrid Security strategy utilizes both cloud and on-premises security platforms, built on a foundation of real-time global threat intelligence, to provide multi-layered, unified and dynamic protection against advanced cyber attacks.

NSFOCUS works with Fortune Global 500 companies, including four of the world’s five largest financial institutions, organizations in insurance, retail, healthcare, critical infrastructure industries as well as government agencies. NSFOCUS has technology and channel partners in more than 60 countries, is a member of both the Microsoft Active Protections Program (MAPP), and the Cloud Security Alliance (CSA). A wholly owned subsidiary of NSFOCUS Technologies Group Co., Ltd., the company has operations in the Americas, Europe, the Middle East and Asia Pacific.