Bug 1179399 - (CVE-2020-8285) VUL-0: CVE-2020-8285: curl: libcurl: FTP wildcard stack overflow (2/3)
(CVE-2020-8285)
VUL-0: CVE-2020-8285: curl: libcurl: FTP wildcard stack overflow (2/3)
Status: RESOLVED FIXED
Classification: Novell Products
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents
unspecified
Other Other
: P3 - Medium : Normal
: ---
Assigned To: Security Team bot
Security Team bot
https://smash.suse.de/issue/272452/
CVSSv3.1:SUSE:CVE-2020-8285:6.5:(AV:N...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-11-30 09:40 UTC by Robert Frohl
Modified: 2021-10-04 14:35 UTC (History)
5 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Backported patch for version curl-7.37.0, SLE-12 and SLE-11-SP3 (8.12 KB, patch)
2020-12-16 17:06 UTC, Pedro Monreal Gonzalez
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Comment 7 Marcus Meissner 2020-12-09 07:02:01 UTC
now public

FTP wildcard stack overflow
===========================

Project curl Security Advisory, December 9th 2020 -
[Permalink](https://curl.se/docs/CVE-2020-8285.html)

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

libcurl offers a wildcard matching functionality, which allows a callback (set
with `CURLOPT_CHUNK_BGN_FUNCTION`) to return information back to libcurl on
how to handle a specific entry in a directory when libcurl iterates over a
list of all available entries.

When this callback returns `CURL_CHUNK_BGN_FUNC_SKIP`, to tell libcurl to not
deal with that file, the internal function in libcurl then calls itself
recursively to handle the next directory entry.

If there's a sufficient amount of file entries and if the callback returns
"skip" enough number of times, libcurl runs out of stack space. The exact
amount will of course vary with platforms, compilers and other environmental
factors.

The content of the remote directory is not kept on the stack, so it seems hard
for the attacker to control exactly what data that overwrites the stack -
however it remains a Denial-Of-Service vector as a malicious user who controls
a server that a libcurl-using application works with under these premises can
trigger a crash.

(There is also a few other ways the function can be made to call itself and
trigger this problem.)

We are not aware of any exploit of this flaw.

INFO
----

This issue was unfortunately reported publicly in the curl GitHub issue
tracker as [issue 6255](https://github.com/curl/curl/issues/6255).

This flaw has existed in curl since commit
[0825cd80a](https://github.com/curl/curl/commit/0825cd80a) in curl 7.21.0.

This functionality is not used by the curl tool so it is not affected.
Further: it is not a very widely used feature.

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

CWE-674: Uncontrolled Recursion

Severity: Medium

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

- Affected versions: libcurl 7.21.0 to and including 7.73.0
- Not affected versions: libcurl < 7.21.0 and libcurl >= 7.74.0

Also note that libcurl is used by many applications, and not always
advertised as such.

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

The internal function is rewritten to instead and more appropriately use an
ordinary loop instead of the recursive approach. This way, the stack use will
remain the same no matter how many files that are skipped.

A [fix for CVE-2020-8285](https://github.com/curl/curl/commit/69a358f2186e04)

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

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

  A - Upgrade curl to version 7.74.0

  B - Disable FTP wildcard use (`CURLOPT_WILDCARDMATCH`)

  C - Make sure your `CURLOPT_CHUNK_BGN_FUNCTION` callback doesn't do multiple skips.

TIMELINE
--------

This issue was first reported to the curl project on November 27, 2020.

This advisory was posted on December 9th 2020.

CREDITS
-------

This issue was initially reported by xnynx on GitHub. Daniel took it to the
security team immediately. Patch by Daniel Stenberg.

Thanks a lot!

-- 

  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://www.wolfssl.com/contact/
Comment 8 Swamp Workflow Management 2020-12-09 23:17:54 UTC
SUSE-SU-2020:3733-1: An update that fixes three vulnerabilities is now available.

Category: security (moderate)
Bug References: 1179398,1179399,1179593
CVE References: CVE-2020-8284,CVE-2020-8285,CVE-2020-8286
JIRA References: 
Sources used:
SUSE Linux Enterprise Module for Basesystem 15-SP1 (src):    curl-7.60.0-3.35.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 9 Swamp Workflow Management 2020-12-09 23:20:58 UTC
SUSE-SU-2020:3735-1: An update that fixes three vulnerabilities is now available.

Category: security (moderate)
Bug References: 1179398,1179399,1179593
CVE References: CVE-2020-8284,CVE-2020-8285,CVE-2020-8286
JIRA References: 
Sources used:
SUSE Linux Enterprise Module for Basesystem 15-SP2 (src):    curl-7.66.0-4.11.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 10 Swamp Workflow Management 2020-12-10 14:21:14 UTC
SUSE-SU-2020:3739-1: An update that fixes three vulnerabilities is now available.

Category: security (moderate)
Bug References: 1179398,1179399,1179593
CVE References: CVE-2020-8284,CVE-2020-8285,CVE-2020-8286
JIRA References: 
Sources used:
SUSE Linux Enterprise Software Development Kit 12-SP5 (src):    curl-7.60.0-11.9.1
SUSE Linux Enterprise Server 12-SP5 (src):    curl-7.60.0-11.9.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 12 Swamp Workflow Management 2020-12-13 11:18:19 UTC
openSUSE-SU-2020:2238-1: An update that fixes three vulnerabilities is now available.

Category: security (moderate)
Bug References: 1179398,1179399,1179593
CVE References: CVE-2020-8284,CVE-2020-8285,CVE-2020-8286
JIRA References: 
Sources used:
openSUSE Leap 15.2 (src):    curl-7.66.0-lp152.3.12.1, curl-mini-7.66.0-lp152.3.12.1
Comment 13 Swamp Workflow Management 2020-12-14 23:31:06 UTC
openSUSE-SU-2020:2249-1: An update that fixes three vulnerabilities is now available.

Category: security (moderate)
Bug References: 1179398,1179399,1179593
CVE References: CVE-2020-8284,CVE-2020-8285,CVE-2020-8286
JIRA References: 
Sources used:
openSUSE Leap 15.1 (src):    curl-7.60.0-lp151.5.18.1, curl-mini-7.60.0-lp151.5.18.1
Comment 14 Pedro Monreal Gonzalez 2020-12-16 17:06:35 UTC
Created attachment 844541 [details]
Backported patch for version curl-7.37.0, SLE-12 and SLE-11-SP3
Comment 18 Swamp Workflow Management 2020-12-21 14:16:51 UTC
SUSE-SU-2020:14585-1: An update that fixes two vulnerabilities is now available.

Category: security (moderate)
Bug References: 1179398,1179399
CVE References: CVE-2020-8284,CVE-2020-8285
JIRA References: 
Sources used:
SUSE Linux Enterprise Server 11-SECURITY (src):    curl-openssl1-7.37.0-70.57.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 20 Swamp Workflow Management 2021-05-27 19:29:16 UTC
SUSE-SU-2021:1786-1: An update that solves 6 vulnerabilities and has one errata is now available.

Category: security (moderate)
Bug References: 1175109,1177976,1179398,1179399,1179593,1183933,1186114
CVE References: CVE-2020-8231,CVE-2020-8284,CVE-2020-8285,CVE-2020-8286,CVE-2021-22876,CVE-2021-22898
JIRA References: 
Sources used:
SUSE OpenStack Cloud Crowbar 9 (src):    curl-7.60.0-4.20.1
SUSE OpenStack Cloud 9 (src):    curl-7.60.0-4.20.1
SUSE Linux Enterprise Server for SAP 12-SP4 (src):    curl-7.60.0-4.20.1
SUSE Linux Enterprise Server 12-SP4-LTSS (src):    curl-7.60.0-4.20.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 21 Marcus Meissner 2021-08-09 12:51:53 UTC
released