[prev in list] [next in list] [prev in thread] [next in thread] 

List:       oss-security
Subject:    [oss-security] Two vulnerabilities patched in GNU Wget: CVE-2017-13089, CVE-2017-13090
From:       NCSC-FI Vulnerability Co-ordination <vulncoord () ficora ! fi>
Date:       2017-10-27 8:21:35
Message-ID: 43bc647b-fc56-779c-bf11-99374e557e2a () ficora ! fi
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

CVE-2017-13089:

The http.c:skip_short_body() function is called in some circumstances,
such as when processing redirects. When the response is sent chunked,
the chunk parser uses strtol() to read each chunk's length, but
doesn't check that the chunk length is a non-negative number. The
code then tries to skip the chunk in pieces of 512 bytes by using the
MIN() macro, but ends up passing the negative chunk length to
connect.c:fd_read(). As fd_read() takes an int argument, the high
32 bits of the chunk length are discarded, leaving fd_read() with
a completely attacker controlled length argument.

Patch attached, original at:

http://git.savannah.gnu.org/cgit/wget.git/commit/?id=d892291fb8ace4c3b73
4ea5125770989c215df3f

CVE-2017-13090:

The retr.c:fd_read_body() function is called when processing OK
responses. When the response is sent chunked, the chunk parser uses
strtol() to read each chunk's length, but doesn't check that the chunk
length is a non-negative number. The code then tries to read the chunk
in pieces of 8192 bytes by using the MIN() macro, but ends up passing
the negative chunk length to retr.c:fd_read(). As fd_read() takes an
int argument, the high 32 bits of the chunk length are discarded,
leaving fd_read() with a completely attacker controlled length
argument. The attacker can corrupt malloc metadata after the allocated
buffer.

Patch attached, original at:

http://git.savannah.gnu.org/cgit/wget.git/commit/?id=ba6b44f6745b14dce41
4761a8e4b35d31b176bba

Reported by:

Antti Levomäki, Christian Jalio, Joonas Pihlaja from Forcepoint

Advisory:

https://www.viestintavirasto.fi/en/2017/haavoittuvuus-2017-037

Also attached are JSON versions of the vulnerability details (in the
CVE 4.0 schema as formatted by Vulnogram, https://vulnogram.github.io/).

Regards,

- -Jussi / NCSC-FI
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBCgAGBQJZ8uxpAAoJEABVfkgMlGK84+wP/0ADB7REF0a85RU3ScvhuwCB
nyDzyoGy0bEFkN+Hia4sIZzSL6ea+EcngUw28A6tMuQGpgYqqKnrxybp39Pou/IU
c1Bl/7Lci4PQRfc/XuhFE6NlqZlG9W7G4Yiijgv2sQNiaHzkIDxaUuahqQOI7AhQ
WGdtBdFIYdBs9DogZuW+cURZ+3F1paPymQozGDQtdZClTL41+YhKbNki47tBzX+7
GWndw3vt75ZGPsBDWFu1m4RUslmEG1+EU7cWYLTqo8+eTirnC9Lo2VS3fkJimdH1
rJDjRCQ1xCiWNwJ4+wpzh2gm0CPlY5MU/1dr6mdGGRIcwqGcSfmEBMaOHTQGVt9b
q2RDY3Otmh/98/3oeKlhyC2e7gyRO1D9i/SGgsCX2Xnfh6AnLg5I6P0xvSGtj/aK
5V5/7q5+xu7OFEOwvgEAN77eYGYFIND6fBMqJFn8kxvac1uNd7ppixuCqsC0rxWE
t1L73B/vFvuOL9G6tq62o8haT578vQj8HQ8/x39PtHzr2giDv4uC4bKCZx6CCKGl
ZNfpTEucZrQDJq/8rtm047o5DGlOjTn+rflRhh2BdNDw6nnek605Ctney80YqFuF
xYkQYSF9XkWcr/xTX1qD7vsMYhYlOqCui/3ej+S01yOVcRbTUSLVsF3jWm4QJlKa
duMI7yGV2dxh4xjfSOoZ
=fq73
-----END PGP SIGNATURE-----

["CVE-2017-13089.json" (application/json)]
["CVE-2017-13090.json" (application/json)]
["CVE-2017-13089.patch" (text/x-patch)]

From d892291fb8ace4c3b734ea5125770989c215df3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
Date: Fri, 20 Oct 2017 10:59:38 +0200
Subject: Fix stack overflow in HTTP protocol handling (CVE-2017-13089)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* src/http.c (skip_short_body): Return error on negative chunk size

Reported-by: Antti Levomäki, Christian Jalio, Joonas Pihlaja from Forcepoint
Reported-by: Juhani Eronen from Finnish National Cyber Security Centre
---
 src/http.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/http.c b/src/http.c
index 5536768..dc31823 100644
--- a/src/http.c
+++ b/src/http.c
@@ -973,6 +973,9 @@ skip_short_body (int fd, wgint contlen, bool chunked)
               remaining_chunk_size = strtol (line, &endl, 16);
               xfree (line);
 
+              if (remaining_chunk_size < 0)
+                return false;
+
               if (remaining_chunk_size == 0)
                 {
                   line = fd_read_line (fd);
-- 
cgit v1.0-41-gc330

["CVE-2017-13090.patch" (text/x-patch)]

From ba6b44f6745b14dce414761a8e4b35d31b176bba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
Date: Fri, 20 Oct 2017 15:15:47 +0200
Subject: Fix heap overflow in HTTP protocol handling (CVE-2017-13090)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* src/retr.c (fd_read_body): Stop processing on negative chunk size

Reported-by: Antti Levomäki, Christian Jalio, Joonas Pihlaja from Forcepoint
Reported-by: Juhani Eronen from Finnish National Cyber Security Centre
---
 src/retr.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/retr.c b/src/retr.c
index c1bc600..6555ed4 100644
--- a/src/retr.c
+++ b/src/retr.c
@@ -378,6 +378,12 @@ fd_read_body (const char *downloaded_filename, int fd, FILE *out, wgint toread,
               remaining_chunk_size = strtol (line, &endl, 16);
               xfree (line);
 
+              if (remaining_chunk_size < 0)
+                {
+                  ret = -1;
+                  break;
+                }
+
               if (remaining_chunk_size == 0)
                 {
                   ret = 0;
-- 
cgit v1.0-41-gc330

["CVE-2017-13089.json.sig" (application/pgp-signature)]
["CVE-2017-13090.json.sig" (application/pgp-signature)]
["CVE-2017-13089.patch.sig" (application/pgp-signature)]
["CVE-2017-13090.patch.sig" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic