curl / Mailing Lists / curl-users / Single Mail

curl-users

[SECURITY ADVISORY] curl: FTP wildcard out of bounds read

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 29 Nov 2017 10:34:22 +0100 (CET)

FTP wildcard out of bounds read
===============================

Project curl Security Advisory, November 29th 2017 -
[Permalink](https://curl.haxx.se/docs/adv_2017-ae72.html)

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

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.

We are not aware of any exploit of this flaw.

INFO

----
This bug was introduced in commit
[0825cd80a62c](https://github.com/curl/curl/commit/0825cd80a62c), May 2010.
The Common Vulnerabilities and Exposures (CVE) project has assigned the name
CVE-2017-8817 to this issue.
AFFECTED VERSIONS
-----------------
- Affected versions: libcurl 7.21.0 to and including 7.56.1
- Not affected versions: libcurl < 7.21.0 and >= 7.57.0
curl is used by many applications, but not always advertised as such.
THE SOLUTION
------------
In libcurl version 7.57.0, there's a better check for the end of the
string. Additionally, the wildcard feature is turned off if the URL passed to
libcurl is not using FTP(S), so a redirect to an FTP URL cannot trigger
wildcard functionality.
A [patch for CVE-2017-8817](https://curl.haxx.se/CVE-2017-8817.patch) is
available.
RECOMMENDATIONS
---------------
We suggest you take one of the following actions immediately, in order of
preference:
  A - Upgrade curl to version 7.57.0
  B - Apply the patch to your version and rebuild
  C - Do not use `CURLOPT_WILDCARDMATCH` without carfully verifying the
      patterns used.
TIME LINE
---------
It was reported to the curl project on November 10, 2017.  We contacted
distros_at_openwall on November 21.
curl 7.57.10 was released on November 29 2017, coordinated with the
publication of this advisory.
CREDITS
-------
Reported by OSS-Fuzz. Researched by Max Dymond. Patch by Daniel Stenberg.
Thanks a lot!
-- 
  / daniel.haxx.se
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2017-11-29