diff --git a/curl-CVE-2013-0249.patch b/curl-CVE-2013-0249.patch new file mode 100644 index 0000000..90d450d --- /dev/null +++ b/curl-CVE-2013-0249.patch @@ -0,0 +1,62 @@ +From ee45a34907ffeb5fd95b0513040d8491d565b663 Mon Sep 17 00:00:00 2001 +From: Eldar Zaitov +Date: Wed, 30 Jan 2013 23:22:27 +0100 +Subject: [PATCH] Curl_sasl_create_digest_md5_message: fix buffer overflow + +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 targetting this flaw. + +Bug: http://curl.haxx.se/docs/adv_20130206.html +--- + lib/curl_sasl.c | 23 ++++++----------------- + 1 file changed, 6 insertions(+), 17 deletions(-) + +Index: curl-7.28.1/lib/curl_sasl.c +=================================================================== +--- curl-7.28.1.orig/lib/curl_sasl.c 2012-08-08 22:45:18.000000000 +0200 ++++ curl-7.28.1/lib/curl_sasl.c 2013-02-07 11:55:15.183277599 +0100 +@@ -345,9 +345,7 @@ CURLcode Curl_sasl_create_digest_md5_mes + snprintf(&HA1_hex[2 * i], 3, "%02x", digest[i]); + + /* Prepare the URL string */ +- strcpy(uri, service); +- strcat(uri, "/"); +- strcat(uri, realm); ++ snprintf(uri, sizeof(uri), "%s/%s", service, realm); + + /* Calculate H(A2) */ + ctxt = Curl_MD5_init(Curl_DIGEST_MD5); +@@ -391,20 +389,11 @@ CURLcode Curl_sasl_create_digest_md5_mes + for(i = 0; i < MD5_DIGEST_LEN; i++) + snprintf(&resp_hash_hex[2 * i], 3, "%02x", digest[i]); + +- strcpy(response, "username=\""); +- strcat(response, userp); +- strcat(response, "\",realm=\""); +- strcat(response, realm); +- strcat(response, "\",nonce=\""); +- strcat(response, nonce); +- strcat(response, "\",cnonce=\""); +- strcat(response, cnonce); +- strcat(response, "\",nc="); +- strcat(response, nonceCount); +- strcat(response, ",digest-uri=\""); +- strcat(response, uri); +- strcat(response, "\",response="); +- strcat(response, resp_hash_hex); ++ snprintf(response, sizeof(response), ++ "username=\"%s\",realm=\"%s\",nonce=\"%s\"," ++ "cnonce=\"%s\",nc=\"%s\",digest-uri=\"%s\",response=%s", ++ userp, realm, nonce, ++ cnonce, nonceCount, uri, resp_hash_hex); + + /* Base64 encode the reply */ + return Curl_base64_encode(data, response, 0, outptr, outlen); diff --git a/curl.changes b/curl.changes index fe43060..70262c1 100644 --- a/curl.changes +++ b/curl.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Feb 7 10:54:15 UTC 2013 - vcizek@suse.com + +- fixed CVE-2013-0249 (bnc#802411) +- refreshed patches + ------------------------------------------------------------------- Fri Jan 11 21:34:38 CET 2013 - sbrabec@suse.cz diff --git a/curl.spec b/curl.spec index c96f350..f370425 100644 --- a/curl.spec +++ b/curl.spec @@ -33,6 +33,7 @@ Source3: baselibs.conf Source4: %{name}.keyring Patch: libcurl-ocloexec.patch Patch1: dont-mess-with-rpmoptflags.diff +Patch2: curl-CVE-2013-0249.patch # Use rpmbuild -D 'VERIFY_SIG 1' to verify signature during build or run one-shot check by "gpg-offline --verify --package=curl curl-*.asc". %if 0%{?VERIFY_SIG} BuildRequires: gpg-offline @@ -98,6 +99,7 @@ user interaction or any kind of interactivity. %setup -q %patch %patch1 +%patch2 -p1 %build autoreconf -fi diff --git a/dont-mess-with-rpmoptflags.diff b/dont-mess-with-rpmoptflags.diff index b5d045b..d5a4646 100644 --- a/dont-mess-with-rpmoptflags.diff +++ b/dont-mess-with-rpmoptflags.diff @@ -1,6 +1,8 @@ ---- configure.ac.orig -+++ configure.ac -@@ -279,10 +279,6 @@ dnl platform/compiler/architecture speci +Index: configure.ac +=================================================================== +--- configure.ac.orig 2013-02-07 11:55:15.150276599 +0100 ++++ configure.ac 2013-02-07 11:55:15.167277116 +0100 +@@ -288,10 +288,6 @@ dnl platform/compiler/architecture speci dnl ********************************************************************** CURL_CHECK_COMPILER diff --git a/libcurl-ocloexec.patch b/libcurl-ocloexec.patch index ce8cfaa..d7a1d2f 100644 --- a/libcurl-ocloexec.patch +++ b/libcurl-ocloexec.patch @@ -7,8 +7,10 @@ To make it portable you have to test O_CLOEXEC support at *runtime* compile time is not enough. ---- lib/cookie.c.orig -+++ lib/cookie.c +Index: lib/cookie.c +=================================================================== +--- lib/cookie.c.orig 2012-08-08 23:38:25.000000000 +0200 ++++ lib/cookie.c 2013-02-07 11:55:15.146276477 +0100 @@ -736,7 +736,7 @@ struct CookieInfo *Curl_cookie_init(stru fp = NULL; } @@ -27,8 +29,10 @@ compile time is not enough. if(!out) return 1; /* failure */ } ---- lib/file.c.orig -+++ lib/file.c +Index: lib/file.c +=================================================================== +--- lib/file.c.orig 2012-11-13 22:04:27.000000000 +0100 ++++ lib/file.c 2013-02-07 11:55:15.147276507 +0100 @@ -249,7 +249,7 @@ static CURLcode file_connect(struct conn fd = open_readonly(actual_path, O_RDONLY|O_BINARY); file->path = actual_path; @@ -47,8 +51,10 @@ compile time is not enough. if(fd < 0) { failf(data, "Can't open %s for writing", file->path); return CURLE_WRITE_ERROR; ---- lib/formdata.c.orig -+++ lib/formdata.c +Index: lib/formdata.c +=================================================================== +--- lib/formdata.c.orig 2012-08-08 22:45:18.000000000 +0200 ++++ lib/formdata.c 2013-02-07 11:55:15.147276507 +0100 @@ -1207,7 +1207,7 @@ CURLcode Curl_getformdata(struct Session FILE *fileread; @@ -67,8 +73,10 @@ compile time is not enough. if(!form->fp) return (size_t)-1; /* failure */ } ---- lib/hostip6.c.orig -+++ lib/hostip6.c +Index: lib/hostip6.c +=================================================================== +--- lib/hostip6.c.orig 2012-03-08 20:35:24.000000000 +0100 ++++ lib/hostip6.c 2013-02-07 11:55:15.147276507 +0100 @@ -45,7 +45,7 @@ #ifdef HAVE_PROCESS_H #include @@ -87,8 +95,10 @@ compile time is not enough. if(s == CURL_SOCKET_BAD) /* an ipv6 address was requested but we can't get/use one */ ipv6_works = 0; ---- lib/if2ip.c.orig -+++ lib/if2ip.c +Index: lib/if2ip.c +=================================================================== +--- lib/if2ip.c.orig 2012-03-08 20:35:24.000000000 +0100 ++++ lib/if2ip.c 2013-02-07 11:55:15.148276537 +0100 @@ -153,7 +153,7 @@ char *Curl_if2ip(int af, const char *int if(len >= sizeof(req.ifr_name)) return NULL; @@ -98,8 +108,10 @@ compile time is not enough. if(CURL_SOCKET_BAD == dummy) return NULL; ---- lib/netrc.c.orig -+++ lib/netrc.c +Index: lib/netrc.c +=================================================================== +--- lib/netrc.c.orig 2012-08-08 22:45:18.000000000 +0200 ++++ lib/netrc.c 2013-02-07 11:55:15.148276537 +0100 @@ -107,7 +107,7 @@ int Curl_parsenetrc(const char *host, netrc_alloc = TRUE; } @@ -109,8 +121,10 @@ compile time is not enough. if(file) { char *tok; char *tok_buf; ---- lib/ssluse.c.orig -+++ lib/ssluse.c +Index: lib/ssluse.c +=================================================================== +--- lib/ssluse.c.orig 2012-11-13 23:01:17.000000000 +0100 ++++ lib/ssluse.c 2013-02-07 11:55:15.149276568 +0100 @@ -437,7 +437,7 @@ int cert_stuff(struct connectdata *conn, STACK_OF(X509) *ca = NULL; int i; @@ -129,8 +143,10 @@ compile time is not enough. if(!fp) { if(strict) failf(data, "SSL: Unable to open issuer cert (%s)", ---- lib/connect.c.orig -+++ lib/connect.c +Index: lib/connect.c +=================================================================== +--- lib/connect.c.orig 2012-11-13 22:02:15.000000000 +0100 ++++ lib/connect.c 2013-02-07 11:55:15.149276568 +0100 @@ -1238,7 +1238,7 @@ CURLcode Curl_socket(struct connectdata (struct curl_sockaddr *)addr); else @@ -140,8 +156,10 @@ compile time is not enough. if(*sockfd == CURL_SOCKET_BAD) /* no socket, no connection */ ---- configure.ac.orig -+++ configure.ac +Index: configure.ac +=================================================================== +--- configure.ac.orig 2012-09-08 22:39:18.000000000 +0200 ++++ configure.ac 2013-02-07 11:58:27.875122101 +0100 @@ -180,6 +180,7 @@ AC_CANONICAL_HOST dnl Get system canonical name AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS]) @@ -158,8 +176,10 @@ compile time is not enough. dnl check for how to do large files AC_SYS_LARGEFILE ---- m4/curl-compilers.m4.orig -+++ m4/curl-compilers.m4 +Index: m4/curl-compilers.m4 +=================================================================== +--- m4/curl-compilers.m4.orig 2012-11-16 13:02:23.000000000 +0100 ++++ m4/curl-compilers.m4 2013-02-07 11:55:15.151276630 +0100 @@ -1272,7 +1272,7 @@ dnl CPPFLAGS from being unexpectedly cha AC_DEFUN([CURL_CHECK_PROG_CC], [ ac_save_CFLAGS="$CFLAGS"