Related Vulnerabilities: CVE-2016-8617  

In libcurl's base64 encode function, the output buffer is allocated as follows without any checks on insize: malloc( insize * 4 / 3 + 4 ) On systems with 32-bit addresses in userspace (e.g. x86, ARM, x32), the multiplication in the expression wraps around if insize is at least 1GB of data. If this happens, an undersized output buffer will be allocated, but the full result will be written, thus causing the memory behind the output buffer to be overwritten. If a username is set directly via CURLOPT_USERNAME (or curl's -u, --user option), this vulnerability can be triggered. The name has to be at least 512MB big in a 32bit system. Systems with 64 bit versions of the size_t type are not affected by this issue.

Severity High

Remote Yes

Type Arbitrary code execution

Description

In libcurl's base64 encode function, the output buffer is allocated as follows without any checks on insize:

malloc( insize * 4 / 3 + 4 )
On systems with 32-bit addresses in userspace (e.g. x86, ARM, x32), the multiplication in the expression wraps around if insize is at least 1GB of data. If this happens, an undersized output buffer will be allocated, but the full result will be written, thus causing the memory behind the output buffer to be overwritten.

If a username is set directly via CURLOPT_USERNAME (or curl's -u, --user option), this vulnerability can be triggered. The name has to be at least 512MB big in a 32bit system.

Systems with 64 bit versions of the size_t type are not affected by this issue.

AVG-66 lib32-libcurl-gnutls 7.50.3-1 7.51.0-1 High Fixed

AVG-65 libcurl-gnutls 7.50.3-1 7.51.0-1 High Fixed

AVG-63 lib32-libcurl-compat 7.50.3-1 7.51.0-1 High Fixed

AVG-62 libcurl-compat 7.50.3-1 7.51.0-1 High Fixed

AVG-61 lib32-curl 7.50.3-1 7.51.0-1 High Fixed

AVG-60 curl 7.50.3-1 7.51.0-1 High Fixed

03 Nov 2016 ASA-201611-9 AVG-65 libcurl-gnutls High multiple issues

03 Nov 2016 ASA-201611-8 AVG-62 libcurl-compat High multiple issues

03 Nov 2016 ASA-201611-7 AVG-60 curl High multiple issues

02 Nov 2016 ASA-201611-5 AVG-63 lib32-libcurl-compat High multiple issues

02 Nov 2016 ASA-201611-4 AVG-61 lib32-curl High multiple issues

03 Nov 2016 ASA-201611-10 AVG-66 lib32-libcurl-gnutls High multiple issues

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