Related Vulnerabilities: CVE-2016-9586  

libcurl's implementation of the printf() functions triggers a buffer overflow when doing a large floating point output. The bug occurs when the conversion outputs more than 255 bytes. The flaw happens because the floating point conversion is using system functions without the correct boundary checks. The functions have been documented as deprecated for a long time and users are discouraged from using them in "new programs" as they are planned to get removed at a future point. But as the functions are present and there's nothing preventing users from using them, we expect there to be a certain amount of existing users in the wild. If there are any application that accepts a format string from the outside without necessary input filtering, it could allow remote attacks.

Severity Medium

Remote Yes

Type Arbitrary code execution

Description

libcurl's implementation of the printf() functions triggers a buffer overflow when doing a large floating point output. The bug occurs when the conversion outputs more than 255 bytes. The flaw happens because the floating point conversion is using system functions without the correct boundary checks.
The functions have been documented as deprecated for a long time and users are discouraged from using them in "new programs" as they are planned to get removed at a future point. But as the functions are present and there's nothing preventing users from using them, we expect there to be a certain amount of existing users in the wild.
If there are any application that accepts a format string from the outside without necessary input filtering, it could allow remote attacks.

AVG-117 lib32-libcurl-gnutls 7.51.0-1 7.52.1-1 Medium Fixed FS#52247

AVG-116 lib32-libcurl-compat 7.51.0-1 7.52.1-1 Medium Fixed FS#52247

AVG-115 lib32-curl 7.51.0-1 7.52.1-1 Medium Fixed FS#52247

AVG-114 libcurl-gnutls 7.51.0-1 7.52.1-1 Medium Fixed FS#52247

AVG-113 libcurl-compat 7.51.0-1 7.52.1-1 Medium Fixed FS#52247

AVG-112 curl 7.51.0-1 7.52.1-1 Medium Fixed FS#52247

03 Jan 2017 ASA-201701-9 AVG-115 lib32-curl Medium multiple issues

03 Jan 2017 ASA-201701-8 AVG-114 libcurl-gnutls Medium multiple issues

03 Jan 2017 ASA-201701-7 AVG-113 libcurl-compat Medium multiple issues

03 Jan 2017 ASA-201701-11 AVG-117 lib32-libcurl-gnutls Medium multiple issues

03 Jan 2017 ASA-201701-10 AVG-116 lib32-libcurl-compat Medium multiple issues

27 Dec 2016 ASA-201612-22 AVG-112 curl Medium multiple issues

https://curl.haxx.se/docs/adv_20161221A.html

This flaw is present in the curl_*printf (curlx_*printf) family of functions, which are not used by curl but are exposed from libcurl.
To be exposed, third-party code would need to be using these long-deprecated functions, with a floating-point specifier and user-controlled (floating-point) input. The overflow itself is of a 256-byte stack-allocated buffer, when the decimal expansion of the float exceeds that by up to 70 bytes. Beyond about 16 digits for a double, the decimal expansion is effectively random so the attacker has very little control over precisely what bytes are written.