From patchwork Mon Feb 18 12:20:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Zacarias X-Patchwork-Id: 221271 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 4FBCD2C0091 for ; Mon, 18 Feb 2013 23:20:30 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id E28212018F; Mon, 18 Feb 2013 12:20:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MV6BCR11XAw5; Mon, 18 Feb 2013 12:20:25 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id C32A426076; Mon, 18 Feb 2013 12:20:24 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 095128F74B for ; Mon, 18 Feb 2013 12:20:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 72C1989BFA for ; Mon, 18 Feb 2013 12:20:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8lZrmRsxvtXj for ; Mon, 18 Feb 2013 12:20:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from loknar.toptech.com.ar (loknar.toptech.com.ar [78.46.79.162]) by whitealder.osuosl.org (Postfix) with ESMTPS id 89FB08459E for ; Mon, 18 Feb 2013 12:20:20 +0000 (UTC) Received: from asgard (host202.190-138-220.telecom.net.ar [190.138.220.202]) (authenticated bits=0) by loknar.toptech.com.ar (8.14.6/8.14.6) with ESMTP id r1ICKDmS022269 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 18 Feb 2013 12:20:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zacarias.com.ar; s=dkey; t=1361190017; bh=9A6XVjN/D1p1dylJiSZl42u7CoATD5GAJPTt7f+qWyU=; h=From:To:Cc:Subject:Date; b=LtoRY9pkFuijlXK4i9xJ8HdHQHilfq0atNC1/ESgLq3lOOAEUBfkhaQKruYljmqnj pnVF/e4pYJl6q+jpp6pvcRlAhRGYRG8QVUK5YJF1Uz5Us2HBo703QlBUMy1FFLFNWE IBBpYcEA+3b/zrVib7aj8Kx1YITPfmZwAwgigWaA= Received: by asgard (sSMTP sendmail emulation); Mon, 18 Feb 2013 09:20:11 -0300 From: Gustavo Zacarias To: buildroot@busybox.net Date: Mon, 18 Feb 2013 09:20:11 -0300 Message-Id: <1361190011-2172-1-git-send-email-gustavo@zacarias.com.ar> X-Mailer: git-send-email 1.7.12.4 X-Virus-Scanned: clamav-milter 0.97.6 at loknar X-Virus-Status: Clean Subject: [Buildroot] [PATCH] libcurl: add SASL security patch X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net Fixes CVE-2013-0249, see http://curl.haxx.se/docs/adv_20130206.html Signed-off-by: Gustavo Zacarias --- package/libcurl/libcurl-cve-2013-0249.patch | 65 +++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 package/libcurl/libcurl-cve-2013-0249.patch diff --git a/package/libcurl/libcurl-cve-2013-0249.patch b/package/libcurl/libcurl-cve-2013-0249.patch new file mode 100644 index 0000000..7d2af2a --- /dev/null +++ b/package/libcurl/libcurl-cve-2013-0249.patch @@ -0,0 +1,65 @@ +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(-) + +diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c +index 57116b6..d07387d 100644 +--- a/lib/curl_sasl.c ++++ b/lib/curl_sasl.c +@@ -346,9 +346,7 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data, + 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); +@@ -392,20 +390,11 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data, + 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); +-- +1.7.10.4 +