SASL buffer overflow
Project curl Security Advisory, February 6th 2013 Permalink
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.
The Common Vulnerabilities and Exposures (CVE) project has assigned the name CVE-2013-0249 to this issue.
CWE-121: Stack-based Buffer Overflow
Also note that libcurl is used by many applications, and not always advertised as such.
libcurl 7.29.0 implements proper bounds checking and will not overflow any buffers even if unrealistically long data chunks are received.
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
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.
It was reported to the curl project on January 30 2013.
curl 7.29.0 was released on February 6 2013, coordinated with the publication of this flaw.
- Reported-by: Volema
- Patched-by: Volema
Thanks a lot!