Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 655266 (CVE-2018-1000300, CVE-2018-1000301) - <net-misc/curl-7.60.0: multiple vulnerabilities (CVE-2018-{1000300,1000301}
Summary: <net-misc/curl-7.60.0: multiple vulnerabilities (CVE-2018-{1000300,1000301}
Status: RESOLVED FIXED
Alias: CVE-2018-1000300, CVE-2018-1000301
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Security
URL:
Whiteboard: A3 [glsa+ cve]
Keywords:
: 655840 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-05-08 13:51 UTC by Thomas Deutschmann (RETIRED)
Modified: 2018-06-20 00:22 UTC (History)
2 users (show)

See Also:
Package list:
net-misc/curl-7.60.0
Runtime testing required: ---
stable-bot: sanity-check+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Deutschmann (RETIRED) gentoo-dev 2018-05-08 13:51:10 UTC
Incoming details.
Comment 1 Thomas Deutschmann (RETIRED) gentoo-dev 2018-05-16 23:33:34 UTC
From http://www.openwall.com/lists/oss-security/2018/05/16/2

RTSP bad headers buffer over-read
=================================

Project curl Security Advisory, May 16th 2018 -
[Permalink](https://curl.haxx.se/docs/adv_2018-b138.html)

VULNERABILITY
-------------

curl can be tricked into reading data beyond the end of a heap based buffer
used to store downloaded content.

When servers send RTSP responses back to curl, the data starts out with a set
of headers. curl parses that data to separate it into a number of headers to
deal with those appropriately and to find the end of the headers that signal
the start of the "body" part.

The function that splits up the response into headers is called
`Curl_http_readwrite_headers()` and in situations where it can't find a single
header in the buffer, it might end up leaving a pointer pointing into the
buffer instead of to the start of the buffer which then later on may lead to
an out of buffer read when code assumes that pointer points to a full buffer
size worth of memory to use.

This could potentially lead to information leakage but most likely a
crash/denial of service for applications if a server triggers this flaw.

We are not aware of any exploit of this flaw.

INFO
----

This bug was originally introduced in May 2003 in [this
commit](https://github.com/curl/curl/commit/b2ef79ef3d47b37) but it didn't
become a problem until we added RTSP in January 2010 in [this
commit](https://github.com/curl/curl/commit/bc4582b68a673d3).

We have only proven this to trigger with RTSP traffic even though this is code
shared with HTTP. We believe this is not a problem for HTTP transfers.

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

CWE-126: Buffer Over-read

AFFECTED VERSIONS
-----------------

- Affected versions: curl 7.20.0 to and including curl 7.59.0
- Not affected versions: curl < 7.20.0 and curl >= 7.60.0

libcurl is used by many applications, but not always advertised as such.

THE SOLUTION
------------

In curl version 7.60.0, curl makes sure to restore the pointer back to where
its supposed to point.

A [patch for CVE-2018-1000301](https://curl.haxx.se/CVE-2018-1000301.patch) is
available.

RECOMMENDATIONS
---------------

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

  A - Upgrade curl to version 7.60.0

  B - Apply the patch to your version and rebuild

TIME LINE
---------

It was reported to the curl project on March 24, 2018

We contacted distros@...nwall on May 7, 2018.

curl 7.60.0 was released on May 16 2018, coordinated with the publication of
this advisory.

CREDITS
-------

Detected by OSS-fuzz. Assisted by Max Dymond. Patch by Daniel Stenberg.


From http://www.openwall.com/lists/oss-security/2018/05/16/1:

FTP shutdown response buffer overflow
=====================================

Project curl Security Advisory, May 16th 2018 -
[Permalink](https://curl.haxx.se/docs/adv_2018-82c2.html)

VULNERABILITY
-------------

curl might overflow a heap based memory buffer when closing down an FTP
connection with very long server command replies.

When doing FTP transfers, curl keeps a spare "closure handle" around
internally that will be used when an FTP connection gets shut down since the
original curl easy handle is then already removed.

FTP server response data that gets cached from the original transfer might
then be larger than the default buffer size (16 KB) allocated in the "closure
handle", which can lead to a buffer overwrite. The contents and size of that
overwrite is controllable by the server.

This situation was detected by an assert() in the code, but that was of course
only preventing bad stuff in debug builds. This bug is very unlikely to
trigger with non-malicious servers.

We are not aware of any exploit of this flaw.

INFO
----

This bug was introduced in April 2017 in [this
commit](https://github.com/curl/curl/commit/e40e9d7f0decc79) when we
introduced the use of increased buffer sizes for FTP.

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

CWE-122: Heap-based Buffer Overflow

AFFECTED VERSIONS
-----------------

- Affected versions: curl 7.54.1 to and including curl 7.59.0
- Not affected versions: curl < 7.54.1 and curl >= 7.60.0

libcurl is used by many applications, but not always advertised as such.

THE SOLUTION
------------

In curl version 7.60.0, curl will return an error if this situation happens.

A [patch for CVE-2018-1000300](https://curl.haxx.se/CVE-2018-1000300.patch) is
available.

RECOMMENDATIONS
---------------

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

  A - Upgrade curl to version 7.60.0

  B - Apply the patch to your version and rebuild

  C - Avoing using FTP

TIME LINE
---------

It was reported to the curl project on March 22, 2018

We contacted distros@...nwall on May 7, 2018.

curl 7.60.0 was released on May 16 2018, coordinated with the publication of
this advisory.

CREDITS
-------

Detected by Dario Weisser. Patch by Daniel Stenberg.
Comment 2 Thomas Deutschmann (RETIRED) gentoo-dev 2018-05-16 23:33:54 UTC
*** Bug 655840 has been marked as a duplicate of this bug. ***
Comment 3 Anthony Basile gentoo-dev 2018-05-17 00:44:14 UTC
I just added 7.60.0 to the tree and we should rapid stabilize it.

KEYWORDS="alpha amd64 arm arm64 ia64 ppc ppc64 x86"
Comment 4 Agostino Sarubbo gentoo-dev 2018-05-17 07:49:58 UTC
amd64 stable
Comment 5 Tobias Klausmann (RETIRED) gentoo-dev 2018-05-17 12:00:27 UTC
Stable on alpha.
Comment 6 Thomas Deutschmann (RETIRED) gentoo-dev 2018-05-17 13:53:28 UTC
x86 stable
Comment 7 Larry the Git Cow gentoo-dev 2018-05-17 22:12:44 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=046bfae45cfd6dfd8202ca02e40aaf428c1abb19

commit 046bfae45cfd6dfd8202ca02e40aaf428c1abb19
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2018-05-17 22:12:22 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2018-05-17 22:12:38 +0000

    net-misc/curl: stable 7.60.0 for ia64, bug #655266
    
    Bug: https://bugs.gentoo.org/655266
    Package-Manager: Portage-2.3.37, Repoman-2.3.9
    RepoMan-Options: --include-arches="ia64"

 net-misc/curl/curl-7.60.0.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 8 Mart Raudsepp gentoo-dev 2018-05-19 09:38:02 UTC
arm64 stable
Comment 9 Larry the Git Cow gentoo-dev 2018-05-19 18:15:20 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b9cc207102a73c5552add4b8142e8ada9688f195

commit b9cc207102a73c5552add4b8142e8ada9688f195
Author:     Rolf Eike Beer <eike@sf-mail.de>
AuthorDate: 2018-05-19 17:51:56 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2018-05-19 18:15:04 +0000

    net-misc/curl: stable 7.60.0 for sparc
    
    Bug: https://bugs.gentoo.org/655266
    Package-Manager: Portage-2.3.24, Repoman-2.3.6
    RepoMan-Options: --include-arches="sparc"

 net-misc/curl/curl-7.60.0.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 10 Sergei Trofimovich (RETIRED) gentoo-dev 2018-05-20 21:12:14 UTC
commit b925147190430117b0bba406fde73dbc2d09c07b
Author: Jeroen Roovers <jer@gentoo.org>
Date:   Sun May 20 16:06:02 2018 +0200

    net-misc/curl: Stable for HPPA too.
Comment 11 Matt Turner gentoo-dev 2018-05-25 03:46:31 UTC
ppc64 stable
Comment 12 Matt Turner gentoo-dev 2018-05-25 04:19:44 UTC
ppc stable
Comment 13 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2018-05-27 14:40:23 UTC
arm stable
Comment 14 Thomas Deutschmann (RETIRED) gentoo-dev 2018-06-07 22:31:24 UTC
@ Maintainer:

Please cleanup and drop <net-misc/curl-7.60.0!
Comment 15 Anthony Basile gentoo-dev 2018-06-12 22:44:11 UTC
(In reply to Thomas Deutschmann from comment #14)
> @ Maintainer:
> 
> Please cleanup and drop <net-misc/curl-7.60.0!

cleanup done
Comment 16 GLSAMaker/CVETool Bot gentoo-dev 2018-06-20 00:22:40 UTC
This issue was resolved and addressed in
 GLSA 201806-05 at https://security.gentoo.org/glsa/201806-05
by GLSA coordinator Aaron Bauman (b-man).