libcurl 'file' Protocol Buffer Overflow Lets Local Users Execute Arbitrary Code
SecurityTracker Alert ID: 1038697|
SecurityTracker URL: http://securitytracker.com/id/1038697
(Links to External Site)
Date: Jun 15 2017
Execution of arbitrary code via local system, User access via local system|
Fix Available: Yes Vendor Confirmed: Yes |
Version(s): 7.53.0 - 7.54.0|
A vulnerability was reported in libcurl. A local user can obtain elevated privileges on the target system.|
A local user can supply a specially crafted 'file:' URL to trigger a buffer overflow in libcurl and potentially execute arbitrary code on the target system with the privileges of the application using libcurl.
Windows-based and DOS-based systems are affected.
A 'file:' URL without the '//' following the colon character can trigger this flaw if the path begins with a drive letter (e.g., 'C'). Systems configured to use 'file' as the default protocol scheme for URLs that do not specify the protocol scheme are also affected.
The vendor was notified on June 4, 2017.
Marcel Raad reported this vulnerability.
A local user may be able to obtain elevated privileges on the target system.|
The vendor has issued a fix (7.54.1).|
The vendor advisory is available at:
Vendor URL: curl.haxx.se/docs/adv_20170614.html (Links to External Site)
|Underlying OS: Windows (Any)|
Source Message Contents
Subject: [oss-security] [SECURITY ADVISORY] curl: URL file scheme drive letter buffer overflow|
URL file scheme drive letter buffer overflow
Project curl Security Advisory, June 14th 2017 -
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.
This flaw also affects the curl command line tool. It was introduced in commit
[1d4202ade602](https://github.com/curl/curl/commit/1d4202ade602), discussed in
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.
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 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
We suggest you take one of the following actions immediately, in order of
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
It was reported to the curl project on June 4, 2017. We contacted MITRE on
libcurl 7.54.1 was released on June 14 2017, coordinated with the publication
of this advisory.
Reported by Marcel Raad. Patch by Daniel Stenberg.
Thanks a lot!