Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 622312 (CVE-2017-9502)

Summary: <net-misc/curl-7.54.1: URL file scheme drive letter buffer overflow (CVE-2017-9502)
Product: Gentoo Security Reporter: Agostino Sarubbo <ago>
Component: VulnerabilitiesAssignee: Gentoo Security <security>
Status: RESOLVED INVALID    
Severity: trivial CC: blueness, sudormrfhalt
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://www.openwall.com/lists/oss-security/2017/06/14/1
Whiteboard: ~2 [stable blocked]
Package list:
Runtime testing required: ---

Description Agostino Sarubbo gentoo-dev 2017-06-20 14:32:42 UTC
From ${URL} :

URL file scheme drive letter buffer overflow
============================================

Project curl Security Advisory, June 14th 2017 -
[Permalink](https://curl.haxx.se/docs/adv_20170614.html)

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

When libcurl is given either

  1. a file: URL that doesn't use two slashes following the colon, or
  2. is told that file is the default scheme to use for URLs without scheme

... and the given path starts with a drive letter and libcurl is built for
Windows or DOS, then libcurl would copy the path with a wrong offset, so that
the end of the given path would write beyond the malloc buffer. Up to seven
bytes too much.

We are not aware of any exploit of this flaw.

INFO
----

This flaw also affects the curl command line tool. It was introduced in commit
[1d4202ade602](https://github.com/curl/curl/commit/1d4202ade602), discussed in
[issue #1124](https://github.com/curl/curl/pull/1124).

HTTP redirects to file: URLs are not affected.

For version 7.54.1, the function that cleans up the file: URLs is fixed to not
copy things out of the buffer!

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

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

This bug is present on libcurl builds that accept drive letters in file names,
which is limited to Windows and DOS builds, including cygwin.

- Affected versions: libcurl 7.53.0 to and including 7.54.0
- Not affected versions: libcurl < 7.53.0 and >= 7.54.1

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

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

The function now takes better care to allocate memory enough to store what's
copied and to copy the strings to the correct output offsets.

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

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

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

  A - Upgrade curl and libcurl to version 7.54.1

  B - Apply the patch to your version and rebuild

  C - Do not use file URLs on Windows

TIME LINE
---------

It was reported to the curl project on June 4, 2017.  We contacted MITRE on
June 7.

libcurl 7.54.1 was released on June 14 2017, coordinated with the publication
of this advisory.

CREDITS
-------

Reported by Marcel Raad. Patch by Daniel Stenberg.

Thanks a lot!
Comment 1 Thomas Deutschmann (RETIRED) gentoo-dev 2017-06-20 14:45:46 UTC
Affects Windows only, at least non security supported architecture in Gentoo.