curl / Docs / Security Problems / SASL buffer overflow

libcurl SASL buffer overflow vulnerability

Project curl Security Advisory, February 6th 2013 permalink

VULNERABILITY

libcurl is vulnerable to a buffer overflow vulnerability when communicating with one of the protocols POP3, SMTP or IMAP.

When negotiating SASL DIGEST-MD5 authentication, the function Curl_sasl_create_digest_md5_message() uses the data provided from the server without doing the proper length checks and that data is then appended to a local fixed-size buffer on the stack.

This vulnerability can be exploited by someone who is in control of a server that a libcurl based program is accessing with POP3, SMTP or IMAP. For applications that accept user provided URLs, it is also thinkable that a malicious user would feed an application with a URL to a server hosting code targeting this flaw.

This vulnerability can be used for remote code execution (RCE) on vulnerable systems.

Both curl the command line tool and applications using the libcurl library are vulnerable.

There is no known exploit for this problem.

The Common Vulnerabilities and Exposures (CVE) project has assigned the name CVE-2013-0249 to this issue.

AFFECTED VERSIONS

SOLUTION

libcurl 7.29.0 implements proper bounds checking and will not overflow any buffers even if unrealistically long data chunks are received.

RECOMMENDATIONS

We suggest you take one of the following actions immediately, in order of preference:

A - Upgrade to curl and libcurl 7.29.0

B - Apply this patch and rebuild libcurl

  https://curl.haxx.se/curl-sasl.patch

C - Rebuild curl with support for vulnerable protocols IMAP, POP3 and SMTP disabled.

D - Disable the vulnerable protocols IMAP, POP3 and SMTP at run-time to forbid libcurl from using them. You can do this with the CURLOPT_PROTOCOLS option.

TIME LINE

Vulnerability found and patched by Volema (http://volema.com/).

It was reported to the curl project on January 30th 2013.

curl 7.29.0 was released on February 6th 2013, coordinated with the publication of this flaw.

CREDITS

Reported and fixed by Volema. Thanks a lot!