Bug 1515760 (CVE-2017-8817)

Summary: CVE-2017-8817 curl: FTP wildcard out of bounds read
Product: [Other] Security Response Reporter: Adam Mariš <amaris>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: bodavis, dbhole, erik-fedora, hhorak, java-maint, john.j5live, jorton, kanderso, kdudka, luhliari, mike, omajid, paul, rwagner, security-response-team, sisharma, slawomir, tim.eilers, yozone
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: curl 7.57.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-01-03 14:48:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1518620, 1518621, 1518622, 1526300    
Bug Blocks: 1515763    
Attachments:
Description Flags
Upstream patch none

Description Adam Mariš 2017-11-21 10:36:58 UTC
libcurl contains a read out of bounds flaw in the FTP wildcard function.

libcurl's FTP wildcard matching feature, which is enabled with the
`CURLOPT_WILDCARDMATCH` option can use a built-in wildcard function or a user
provided one. The built-in wildcard function has a flaw that makes it not
detect the end of the pattern string if it ends with an open bracket (`[`) but
instead it will continue reading the heap beyond the end of the URL buffer
that holds the wildcard.

For applications that use HTTP(S) URLs, allow libcurl to handle redirects and
have FTP wildcards enabled, this flaw can be triggered by malicious servers
that can redirect clients to a URL using such a wildcard pattern.

- Affected versions: libcurl 7.21.0 to and including 7.56.1
- Not affected versions: libcurl < 7.21.0 and >= 7.57.0

Comment 2 Adam Mariš 2017-11-21 10:43:41 UTC
Created attachment 1356600 [details]
Upstream patch

Comment 3 Adam Mariš 2017-11-21 10:46:20 UTC
Acknowledgments:

Name: the Curl project
Upstream: the OSS-Fuzz project

Comment 4 Adam Mariš 2017-11-21 10:47:12 UTC
Issue was introduced by commit:

https://github.com/curl/curl/commit/0825cd80a62c

Comment 5 Adam Mariš 2017-11-29 10:49:01 UTC
External References:

https://curl.haxx.se/docs/adv_2017-ae72.html

Comment 6 Adam Mariš 2017-11-29 10:52:23 UTC
Created curl tracking bugs for this issue:

Affects: fedora-all [bug 1518621]


Created mingw-curl tracking bugs for this issue:

Affects: epel-7 [bug 1518622]
Affects: fedora-all [bug 1518620]

Comment 10 Tomas Hoger 2018-01-03 14:48:42 UTC
It should be noted that the affected functionality - FTP wildcard file matching - is not enabled by default and must be enabled explicitly in applications using libcurl using the CURLOPT_WILDCARDMATCH option.  The curl command line tool does not enable the feature or provide a way for user to enable it.  The curl tool's globbing functionality controlled via the -g / --globoff option is unrelated to this FTP wildcard matching.

The rare use of this functionality reduces the impact of this flaw.

Comment 11 errata-xmlrpc 2018-11-13 08:35:05 UTC
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 6
  Red Hat Software Collections for Red Hat Enterprise Linux 7
  Red Hat Software Collections for Red Hat Enterprise Linux 7.4 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.5 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.6 EUS

Via RHSA-2018:3558 https://access.redhat.com/errata/RHSA-2018:3558