X-Original-To: alpine-aports@lists.alpinelinux.org Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by lists.alpinelinux.org (Postfix) with ESMTP id 63AC95C418A for ; Wed, 18 Jan 2017 14:53:52 +0000 (GMT) Received: by mail-lf0-f68.google.com with SMTP id q89so2094984lfi.1 for ; Wed, 18 Jan 2017 06:53:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/NzalzhltZUPzushKwdRYOFwEI3dJ40Tg2ra3PApjC4=; b=JczLrBoDkOstzEZBpWYw+kGUWLO1vxfXsQDbNU93h5ce6sWSR35qZhu1weHknXQXaF g9Dyi8t3HjayV9YJ1DbTHBonGbbhK7BTZ0bYAidHuPkpVAQ5ruqxMH9cWSo406oq37FZ H9yHq9UX0hBSYGnxKVQo/nZ18aFQzRtdFKlXMWfXsul9d4Npejp/Kt/MW1ZLYBXMCjmZ ilv1AlCzNCYbyeo85usIPSDMNwe5i+0Yt3a2xc74h1klg2Oi9HeQmjYcJFdxgLAyaPWR aDeOOPmy8xs5Vb350yrU1FFYYcy9niUQbJG/uaz98mdeWgIx3/9R44uOVnwWeklRhNuk UcZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/NzalzhltZUPzushKwdRYOFwEI3dJ40Tg2ra3PApjC4=; b=R2m6hA1FnwQx0Qfe2U7R5U37B34fen/8lvUJUhz76p4zdArUg064T/InjJVW6s8Nvw 6q0pinDjnS0sB4pI/6bDso2Tj+7FOS4txSdfKFMcS6JZ7WsGkpfK8lYJlydMVdQqgZMH ICgwWWfcKwTitwPM8//4tjOfsWj7aUSC/4pg8TCJBFUvT7r4oKeWOJ42gkD2+5lNA+uw xj2qPsq8S03nDr8BKfFPiC5/YKjLPyeCHA9aGZGiaPBFJ3Yaqa3S01POZBWrz9NN4j8h VAi3f3xgVVla7rEzKibl/D97a4r041JvEp19bjI9WkkVOBDa1klsum6TnC5qWjcjq2VI cvUQ== X-Gm-Message-State: AIkVDXLJy8nVU/eE0z8p3XVc5dbAdEAhfEZT/9YnvdejihqZwBuBImYPYsUwQcmsvOJf+Q== X-Received: by 10.25.132.6 with SMTP id g6mr1550852lfd.144.1484751231502; Wed, 18 Jan 2017 06:53:51 -0800 (PST) Received: from v3-3.util.wtbts.net ([83.145.235.199]) by smtp.gmail.com with ESMTPSA id 4sm315364ljv.40.2017.01.18.06.53.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Jan 2017 06:53:50 -0800 (PST) From: Sergei Lukin To: alpine-aports@lists.alpinelinux.org Cc: Sergei Lukin Subject: [alpine-aports] [PATCH v3.3] main/libvncserver: security fixes #6640 Date: Wed, 18 Jan 2017 14:53:43 +0000 Message-Id: <1484751223-10807-1-git-send-email-sergej.lukin@gmail.com> X-Mailer: git-send-email 2.6.6 X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: CVE-2016-9941: Heap-based buffer overflow in rfbproto.c CVE-2016-9942: Heap-based buffer overflow in ultra.c --- main/libvncserver/APKBUILD | 22 +++++++++--- main/libvncserver/CVE-2016-9941.patch | 66 +++++++++++++++++++++++++++++++++++ main/libvncserver/CVE-2016-9942.patch | 41 ++++++++++++++++++++++ 3 files changed, 125 insertions(+), 4 deletions(-) create mode 100644 main/libvncserver/CVE-2016-9941.patch create mode 100644 main/libvncserver/CVE-2016-9942.patch diff --git a/main/libvncserver/APKBUILD b/main/libvncserver/APKBUILD index c93b528..86e6cdd 100644 --- a/main/libvncserver/APKBUILD +++ b/main/libvncserver/APKBUILD @@ -1,8 +1,9 @@ +# Contributor: Sergei Lukin # Contributor: Natanael Copa # Maintainer: pkgname=libvncserver pkgver=0.9.10 -pkgrel=1 +pkgrel=2 pkgdesc="Library to make writing a vnc server easy" url="http://libvncserver.sourceforge.net/" arch="all" @@ -16,8 +17,15 @@ install="" subpackages="$pkgname-dev" source="http://downloads.sf.net/libvncserver/LibVNCServer-$pkgver.tar.gz" source="https://github.com/LibVNC/libvncserver/archive/LibVNCServer-$pkgver.tar.gz + CVE-2016-9941.patch + CVE-2016-9942.patch " +# secfixes: +# 0.9.10-r2: +# - CVE-2016-9941 +# - CVE-2016-9942 + _builddir="$srcdir"/libvncserver-LibVNCServer-$pkgver prepare() { local i @@ -46,6 +54,12 @@ package() { make install DESTDIR="$pkgdir" || return 1 } -md5sums="e1b888fae717b06896f8aec100163d27 LibVNCServer-0.9.10.tar.gz" -sha256sums="ed10819a5bfbf269969f97f075939cc38273cc1b6d28bccfb0999fba489411f7 LibVNCServer-0.9.10.tar.gz" -sha512sums="eb637dfb72dc50fb713a715c9d0cc8824a6871527c2edb497e70c92e2e708021fbd5d8134f2dee6a9e90d1c8fd3fee53c5f5ece790c2804e938011a980ffceae LibVNCServer-0.9.10.tar.gz" +md5sums="e1b888fae717b06896f8aec100163d27 LibVNCServer-0.9.10.tar.gz +d97e55435a06ff3870fae3669975b950 CVE-2016-9941.patch +1f1f20acce8988a6be3620d1765749a2 CVE-2016-9942.patch" +sha256sums="ed10819a5bfbf269969f97f075939cc38273cc1b6d28bccfb0999fba489411f7 LibVNCServer-0.9.10.tar.gz +9073e1d3f734bd6a4fc003de7163f861d38234a78ac585665d96e386b8dc22ae CVE-2016-9941.patch +2c4d908d71713012d542345ededbe49f60cc0ad76ca96d111e18fd5374528b34 CVE-2016-9942.patch" +sha512sums="eb637dfb72dc50fb713a715c9d0cc8824a6871527c2edb497e70c92e2e708021fbd5d8134f2dee6a9e90d1c8fd3fee53c5f5ece790c2804e938011a980ffceae LibVNCServer-0.9.10.tar.gz +c0796f0c45fe6cd23ceeba45a2b6efb90a5499b096ea7f5850722fb68b5bbde01fdf001bf582614328862bc3b40f9c9dc9d6c75aa1aa6c002d5eec505d0ffeee CVE-2016-9941.patch +36f22fdf49ac494d8d4c66c1d4ce03d2b62ed54a7726b2951129a18263ca964dbaa0b0c38ab2cee04dbb276a234bc0ee9ca3b396f0bb244288717ddd86347f15 CVE-2016-9942.patch" diff --git a/main/libvncserver/CVE-2016-9941.patch b/main/libvncserver/CVE-2016-9941.patch new file mode 100644 index 0000000..b36fc63 --- /dev/null +++ b/main/libvncserver/CVE-2016-9941.patch @@ -0,0 +1,66 @@ +commit 5418e8007c248bf9668d22a8c1fa9528149b69f2 +Author: Josef Gajdusek +Date: Mon Nov 14 11:39:01 2016 +0100 + + Fix heap overflows in the various rectangle fill functions + + Altough rfbproto.c does check whether the overall FramebufferUpdate rectangle is + too large, some of the individual encoding decoders do not, which allows a + malicious server to overwrite parts of the heap. + +diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c +index 94b9bdb..9edfbad 100644 +--- a/libvncclient/rfbproto.c ++++ b/libvncclient/rfbproto.c +@@ -147,6 +147,10 @@ void* rfbClientGetClientData(rfbClient* client, void* tag) + + /* messages */ + ++static boolean CheckRect(rfbClient* client, int x, int y, int w, int h) { ++ return x + w <= client->width && y + h <= client->height; ++} ++ + static void FillRectangle(rfbClient* client, int x, int y, int w, int h, uint32_t colour) { + int i,j; + +@@ -154,6 +158,11 @@ static void FillRectangle(rfbClient* client, int x, int y, int w, int h, uint32_ + return; + } + ++ if (!CheckRect(client, x, y, w, h)) { ++ rfbClientLog("Rect out of bounds: %dx%d at (%d, %d)\n", x, y, w, h); ++ return; ++ } ++ + #define FILL_RECT(BPP) \ + for(j=y*client->width;j<(y+h)*client->width;j+=client->width) \ + for(i=x;iwidth * BPP / 8; \ +@@ -201,6 +215,16 @@ static void CopyRectangleFromRectangle(rfbClient* client, int src_x, int src_y, + return; + } + ++ if (!CheckRect(client, src_x, src_y, w, h)) { ++ rfbClientLog("Source rect out of bounds: %dx%d at (%d, %d)\n", src_x, src_y, w, h); ++ return; ++ } ++ ++ if (!CheckRect(client, dest_x, dest_y, w, h)) { ++ rfbClientLog("Dest rect out of bounds: %dx%d at (%d, %d)\n", dest_x, dest_y, w, h); ++ return; ++ } ++ + #define COPY_RECT_FROM_RECT(BPP) \ + { \ + uint##BPP##_t* _buffer=((uint##BPP##_t*)client->frameBuffer)+(src_y-dest_y)*client->width+src_x-dest_x; \ diff --git a/main/libvncserver/CVE-2016-9942.patch b/main/libvncserver/CVE-2016-9942.patch new file mode 100644 index 0000000..d79ac4a --- /dev/null +++ b/main/libvncserver/CVE-2016-9942.patch @@ -0,0 +1,41 @@ +commit 5fff4353f66427b467eb29e5fdc1da4f2be028bb +Author: Josef Gajdusek +Date: Mon Nov 14 12:38:05 2016 +0100 + + Fix heap overflow in the ultra.c decoder + + The Ultra type tile decoder does not use the _safe variant of the LZO + decompress function, which allows a maliciuous server to overwrite parts of the + heap by sending a larger-than-specified LZO data stream. + +diff --git a/libvncclient/ultra.c b/libvncclient/ultra.c +index dac89b5..32a1b2b 100644 +--- a/libvncclient/ultra.c ++++ b/libvncclient/ultra.c +@@ -86,14 +86,14 @@ HandleUltraBPP (rfbClient* client, int rx, int ry, int rw, int rh) + + /* uncompress the data */ + uncompressedBytes = client->raw_buffer_size; +- inflateResult = lzo1x_decompress( ++ inflateResult = lzo1x_decompress_safe( + (lzo_byte *)client->ultra_buffer, toRead, + (lzo_byte *)client->raw_buffer, (lzo_uintp) &uncompressedBytes, + NULL); + +- ++ /* Note that uncompressedBytes will be 0 on output overrun */ + if ((rw * rh * (BPP / 8)) != uncompressedBytes) +- rfbClientLog("Ultra decompressed too little (%d < %d)", (rw * rh * (BPP / 8)), uncompressedBytes); ++ rfbClientLog("Ultra decompressed unexpected amount of data (%d != %d)\n", (rw * rh * (BPP / 8)), uncompressedBytes); + + /* Put the uncompressed contents of the update on the screen. */ + if ( inflateResult == LZO_E_OK ) +@@ -168,7 +168,7 @@ HandleUltraZipBPP (rfbClient* client, int rx, int ry, int rw, int rh) + + /* uncompress the data */ + uncompressedBytes = client->raw_buffer_size; +- inflateResult = lzo1x_decompress( ++ inflateResult = lzo1x_decompress_safe( + (lzo_byte *)client->ultra_buffer, toRead, + (lzo_byte *)client->raw_buffer, &uncompressedBytes, NULL); + if ( inflateResult != LZO_E_OK ) -- 2.6.6 --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---