
====================================================================

                             CERT-Renater

                 Note d'Information No. 2018/VULN031
_____________________________________________________________________

DATE                : 24/01/2018

HARDWARE PLATFORM(S): /

OPERATING SYSTEM(S): Systems running libcurl versions prior to 7.58.0.

=====================================================================
https://curl.haxx.se/docs/adv_2018-b3bf.html
https://curl.haxx.se/docs/adv_2018-824a.html
_____________________________________________________________________


HTTP authentication leak in redirects
=====================================

Project curl Security Advisory, January 24th 2018 -
[Permalink](https://curl.haxx.se/docs/adv_2018-b3bf.html)

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

libcurl might leak authentication data to third parties.

When asked to send custom headers in its HTTP requests, libcurl will
send that set of headers first to the host in the initial URL but also,
if asked to follow redirects and a 30X HTTP response code is returned,
to the host mentioned in URL in the `Location:` response header value.

Sending the same set of headers to subsequest hosts is in particular a
problem for applications that pass on custom `Authorization:` headers,
as this header often contains privacy sensitive information or data that
could allow others to impersonate the libcurl-using client's request.

We are not aware of any exploit of this flaw.

INFO
----

This bug has existed since before curl 6.0. It existed in the first
commit we have recorded in the project.

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

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

- Affected versions: libcurl 7.1 to and including 7.57.0
- Not affected versions: libcurl >= 7.58.0

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

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

In libcurl version 7.58.0, custom `Authorization:` headers will be
limited the same way other such headers is controlled within libcurl:
they will only be sent to the host used in the original URL unless
libcurl is told that it is ok to pass on to others using the
`CURLOPT_UNRESTRICTED_AUTH` option.

**NOTE**: this solution creates a slight change in behavior. Users who
actually want to pass on the header to other hosts now need to give curl
that specific permission. You do this with
[--location-trusted](https://curl.haxx.se/docs/manpage.html#--location-trusted)
with the curl command line tool.

A [patch for
CVE-2018-1000007](https://github.com/curl/curl/commit/af32cd3859336ab.patch)
is available.

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

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

  A - Upgrade curl to version 7.58.0

  B - Apply the patch to your version and rebuild

  C - Do not enable CURLOPT_FOLLOWLOCATION if you pass on custom
Authorization headers

TIME LINE
---------

It was reported to the curl project on January 18, 2018

We contacted distros@...nwall on January 19.

curl 7.58.0 was released on January 24 2018, coordinated with the
publication of this advisory.

CREDITS
-------

Reported by Craig de Stigter. Patch by Daniel Stenberg.

Thanks a lot!



  / daniel.haxx.se

_____________________________________________________________________

HTTP/2 trailer out-of-bounds read
=================================

Project curl Security Advisory, January 24th 2018 -
[Permalink](https://curl.haxx.se/docs/adv_2018-824a.html)

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

libcurl contains an out bounds read in code handling HTTP/2 trailers.

It was [reported](https://github.com/curl/curl/pull/2231) that reading
an HTTP/2 trailer could mess up future trailers since the stored size
was one byte less than required.

The problem is that the code that creates HTTP/1-like headers from the
HTTP/2 trailer data once appended a string like `":"` to the target
buffer, while this was recently changed to `": "` (a space was added
after the colon) but the associated math wasn't updated correspondingly.

When accessed, the data is read out of bounds and causes either a crash
or that the (too large) data gets passed to the libcurl callback. This
might lead to a denial-of-service situation or an information disclosure
if someone has a service that echoes back or uses the trailers for
something.

We are not aware of any exploit of this flaw.

INFO
----

This bug was introduced in commit
[0761a51ee0551ad9e5](https://github.com/curl/curl/commit/0761a51ee0551ad9e5),
May 11 2016.

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

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

- Affected versions: libcurl 7.49.0 to and including 7.57.0
- Not affected versions: libcurl < 7.49.0 and >= 7.58.0

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

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

In libcurl version 7.58.0, the allocation size is corrected.

A [patch for
CVE-2018-1000005](https://github.com/curl/curl/commit/fa3dbb9a147488a294.patch)
is available.

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

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

  A - Upgrade curl to version 7.58.0

  B - Apply the patch to your version and rebuild

TIME LINE
---------

It was publicly [reported to the curl
project](https://github.com/curl/curl/issues/2231) on January 10, 2018.

The security impact was realized and assessed on January 11. The fix was
merged publicly in git on the same day, not mentioning the security impact.

We contacted distros@...nwall on January 17.

curl 7.58.0 was released on January 24 2018, coordinated with the
publication of this advisory.

CREDITS
-------

Reported and patched by Zhouyihai Ding. Researched by Ray Satiro.

Thanks a lot!


==========================================================
+ CERT-RENATER          | tel : 01-53-94-20-44           +
+ 23 - 25 Rue Daviel    | fax : 01-53-94-20-41           +
+ 75013 Paris           | email: cert@support.renater.fr +
==========================================================




