Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 474354 (CVE-2013-2174) - <net-misc/curl-7.31.0 : URL decode buffer boundary flaw (CVE-2013-2174)
Summary: <net-misc/curl-7.31.0 : URL decode buffer boundary flaw (CVE-2013-2174)
Status: RESOLVED FIXED
Alias: CVE-2013-2174
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal major (vote)
Assignee: Gentoo Security
URL: http://curl.haxx.se/mail/archive-2013...
Whiteboard: A2 [glsa]
Keywords:
: 490336 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-06-22 21:00 UTC by Agostino Sarubbo
Modified: 2014-01-20 14:11 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2013-06-22 21:00:38 UTC
From ${URL} :

1. VULNERABILITY 
   libcurl is vulnerable to a case of bad checking of the input data which may 
   lead to heap corruption. 
   The function curl_easy_unescape() decodes URL encoded strings to raw binary 
   data. URL encoded octets are represented with %HH combinations where HH is a 
   two-digit hexadecimal number. The decoded string is written to an allocated 
   memory area that the function returns to the caller. 
   The function takes a source string and a length parameter, and if the length 
   provided is 0 the function will instead use strlen() to figure out how much 
   data to parse. 
   The "%HH" parser wrongly only considered the case where a zero byte would 
   terminate the input. If a length-limited buffer was passed in which ended 
   with a '%' character which was followed by two hexadecimal digits outside of 
   the buffer libcurl was allowed to parse alas without a terminating zero, 
   libcurl would still parse that sequence as well. The counter for remaining 
   data to handle would then be decreased too much and wrap to become a very 
   large integer and the copying would go on too long and the destination 
   buffer that is allocated on the heap would get overwritten. 
   We consider it unlikely that programs allow user-provided strings unfiltered 
   into this function. Also, only the not zero-terminated input string use case 
   is affected by this flaw. Exploiting this flaw for gain is probably possible 
   for specific circumstances but we consider the general risk for this to be 
   low. 
   The curl command line tool is not affected by this problem as it doesn't use 
   this function. 
   There are no known exploits available at this time. 
   The Common Vulnerabilities and Exposures (CVE) project has assigned the name 
   CVE-2013-2174 to this issue. 
2. AFFECTED VERSIONS 
   Affected versions: from libcurl 7.7 to and including 7.30.0 
   Not affected versions: libcurl before 7.7 and >= 7.31.0 
   libcurl is used by many applications, but not always advertised as such! 
3. THE SOLUTION 
   libcurl 7.31.0 implements a proper check that the following hexdigits are 
   within the provided input length. 
4. RECOMMENDATIONS 
   We suggest you take one of the following actions immediately, in order of 
   preference: 
   A - Upgrade to curl and libcurl 7.31.0 
   B - Apply this patch and rebuild libcurl 
       http://curl.haxx.se/libcurl-unescape.patch 
   C - Double-check your curl_easy_unescape() usage (for example use it with 
       the 'length' argument set to 0), or avoid using that function 
5. TIME LINE 
   Vulnerability found by Timo Sirainen. Patched by Daniel Stenberg. 
   It was reported to the curl project on May 19th 2013. We contacted 
   linux-distros on June 12th. 
   curl 7.31.0 was released on June 22nd 2013, coordinated with the 
   publication of this advisory. 
6. CREDITS 
   Reported by Timo Sirainen. Thanks a lot! 


@maintainer(s): after the bump, in case we need to stabilize the package, please say explicitly if it is ready for the stabilization or not.
Comment 1 Chris Reffett (RETIRED) gentoo-dev Security 2013-06-28 01:58:29 UTC
7.31.0 is currently in the tree.
Comment 2 Chris Reffett (RETIRED) gentoo-dev Security 2013-07-07 15:23:32 UTC
Arches, please stabilize =net-misc/curl-7.31.0, target arches: alpha amd64 arm ppa ia64 ppc ppc64 s390 sh sparc x86. Thanks!
Comment 3 Anthony Basile gentoo-dev 2013-07-07 16:41:00 UTC
(In reply to Chris Reffett from comment #2)
> Arches, please stabilize =net-misc/curl-7.31.0, target arches: alpha amd64
> arm ppa ia64 ppc ppc64 s390 sh sparc x86. Thanks!

Good idea.  It seems to be working fine.
Comment 4 Anthony Basile gentoo-dev 2013-08-12 11:00:35 UTC
(In reply to Chris Reffett from comment #2)
> Arches, please stabilize =net-misc/curl-7.31.0, target arches: alpha amd64
> arm ppa ia64 ppc ppc64 s390 sh sparc x86. Thanks!

the arch teams were never cc-ed
Comment 5 Anthony Basile gentoo-dev 2013-08-12 13:29:32 UTC
(In reply to Anthony Basile from comment #4)
> (In reply to Chris Reffett from comment #2)
> > Arches, please stabilize =net-misc/curl-7.31.0, target arches: alpha amd64
> > arm ppa ia64 ppc ppc64 s390 sh sparc x86. Thanks!
> 
> the arch teams were never cc-ed

stable ppc ppc64
Comment 6 Agostino Sarubbo gentoo-dev 2013-08-13 09:32:16 UTC
amd64 stable
Comment 7 Agostino Sarubbo gentoo-dev 2013-08-18 12:49:22 UTC
alpha stable
Comment 8 Agostino Sarubbo gentoo-dev 2013-08-18 12:49:39 UTC
sparc stable
Comment 9 Agostino Sarubbo gentoo-dev 2013-08-18 12:49:57 UTC
x86 stable
Comment 10 Anthony Basile gentoo-dev 2013-08-18 13:17:48 UTC
arm stable
Comment 11 GLSAMaker/CVETool Bot gentoo-dev 2013-08-27 03:48:28 UTC
CVE-2013-2174 (http://nvd.nist.gov/nvd.cfm?cvename=CVE-2013-2174):
  Heap-based buffer overflow in the curl_easy_unescape function in
  lib/escape.c in cURL and libcurl 7.7 through 7.30.0 allows remote attackers
  to cause a denial of service (application crash) or possibly execute
  arbitrary code via a crafted string ending in a "%" (percent) character.
Comment 12 Agostino Sarubbo gentoo-dev 2013-08-28 12:08:10 UTC
s390 stable
Comment 13 Agostino Sarubbo gentoo-dev 2013-08-28 12:08:59 UTC
sh stable
Comment 14 Sergey Popov gentoo-dev 2013-08-29 11:08:40 UTC
Added to existing GLSA draft
Comment 15 Anthony Basile gentoo-dev 2013-10-29 16:35:55 UTC
(In reply to Sergey Popov from comment #14)
> Added to existing GLSA draft

Should I be removing <net-misc/curl-7.31.0 yet?
Comment 16 Chris Reffett (RETIRED) gentoo-dev Security 2013-10-29 16:55:34 UTC
Yes please.
Comment 17 Anthony Basile gentoo-dev 2013-10-29 17:55:59 UTC
(In reply to Chris Reffett from comment #16)
> Yes please.

Massive cleanup!
Comment 18 Jeroen Roovers (RETIRED) gentoo-dev 2013-10-30 15:26:16 UTC
*** Bug 489852 has been marked as a duplicate of this bug. ***
Comment 19 Jeroen Roovers (RETIRED) gentoo-dev 2013-10-30 15:41:54 UTC
Stable for HPPA.
Comment 20 Jeroen Roovers (RETIRED) gentoo-dev 2013-11-02 16:13:57 UTC
And another one.
Comment 21 Rick Farina (Zero_Chaos) gentoo-dev 2013-11-06 17:55:49 UTC
(In reply to Chris Reffett from comment #16)
> Yes please.

No, it wasn't stable on ia64 and autobuilds got broken.

Please be more careful people, I have restored curl-7.30.0.
Comment 22 Rick Farina (Zero_Chaos) gentoo-dev 2013-11-07 02:44:35 UTC
*** Bug 490336 has been marked as a duplicate of this bug. ***
Comment 23 Anthony Basile gentoo-dev 2013-11-07 13:33:06 UTC
(In reply to Rick Farina (Zero_Chaos) from comment #21)
> (In reply to Chris Reffett from comment #16)
> > Yes please.
> 
> No, it wasn't stable on ia64 and autobuilds got broken.
> 
> Please be more careful people, I have restored curl-7.30.0.

You should have dropped the keywords on 7.30.0 from

KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"

to

KEYWORDS="ia64"

since we only need it for that arch.  I'll commit this change if there are no objectins.
Comment 24 Rick Farina (Zero_Chaos) gentoo-dev 2013-11-07 15:47:23 UTC
(In reply to Anthony Basile from comment #23)
> You should have dropped the keywords on 7.30.0 from
> 
> KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86
> ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd
> ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~x86-linux
> ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris
> ~x64-solaris ~x86-solaris"
> 
> to
> 
> KEYWORDS="ia64"

no objections, but due to visibility this makes pretty much no difference as portage is going to take the higher stable version anyway.  In reality it is not common practice to remove keywords from an older ebuild as they are added stable to the newer one, even if it is a security bug.
Comment 25 Sergey Popov gentoo-dev 2013-11-11 07:58:32 UTC
(In reply to Rick Farina (Zero_Chaos) from comment #24)
> no objections, but due to visibility this makes pretty much no difference as
> portage is going to take the higher stable version anyway.  In reality it is
> not common practice to remove keywords from an older ebuild as they are
> added stable to the newer one, even if it is a security bug.

True, but another way would be masking on every arch and unmask on ia64. I think this keywording trick is better for this case.
Comment 26 Agostino Sarubbo gentoo-dev 2013-11-12 20:13:36 UTC
ia64 stable.

Maintainer(s), please cleanup.
Security, please add it to the existing request, or file a new one.
Comment 27 Yury German Gentoo Infrastructure gentoo-dev 2013-11-12 23:07:26 UTC
Added to existing GLSA draft.

Pleaser remove vulnerable versions (cleanup)
Comment 28 Anthony Basile gentoo-dev 2013-12-18 15:48:07 UTC
(In reply to Yury German from comment #27)
> Added to existing GLSA draft.
> 
> Pleaser remove vulnerable versions (cleanup)

<net-misc/curl-7.31.0 is off the tree.
Comment 29 GLSAMaker/CVETool Bot gentoo-dev 2014-01-20 14:11:25 UTC
This issue was resolved and addressed in
 GLSA 201401-14 at http://security.gentoo.org/glsa/glsa-201401-14.xml
by GLSA coordinator Sergey Popov (pinkbyte).