Dizzy-next
PATCH 2/4 grep2.19: CVE-2015-1345
In reply to Armin KusterFrom: Sona Sarmadi <[email protected]>
Fixes heap-based buffer overflow flaw in grep.
Affected versions are: grep 2.19 through 2.21
Removed THANKS.in changes from upstream patch since this file does not exist in version 2.19.
Replaced tab with spaces in SRC_URI as well.
Upstream fix:
http://git.sv.gnu.org/cgit/grep.git/commit/?id=83a95bd8c8561875b948cadd417c653dbe7ef2e2
--- .../grep/grep-2.19/grep2.19-CVE-2015-1345.patch | 129 +++++++++++++++++++++ meta/recipes-extended/grep/grep_2.19.bb | 4 +- 2 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-extended/grep/grep-2.19/grep2.19-CVE-2015-1345.patch
meta/recipes-extended/grep/grep-2.19/grep2.19-CVE-2015-1345.patch new file +129 -0
@@ -0,0 +1,129 @@ +From 83a95bd8c8561875b948cadd417c653dbe7ef2e2 Mon Sep 17 00:00:00 2001 +From: Yuliy Pisetsky <[email protected]> +Date: Thu, 01 Jan 2015 23:36:55 +0000 +Subject: grep -F: fix a heap buffer (read) overrun + +grep's read buffer is often filled to its full size, except when +reading the final buffer of a file. In that case, the number of +bytes read may be far less than the size of the buffer. However, for +certain unusual pattern/text combinations, grep -F would mistakenly +examine bytes in that uninitialized region of memory when searching +for a match. With carefully chosen inputs, one can cause grep -F to +read beyond the end of that buffer altogether. This problem arose via +commit v2.18-90-g73893ff with the introduction of a more efficient +heuristic using what is now the memchr_kwset function. The use of +that function in bmexec_trans could leave TP much larger than EP, +and the subsequent call to bm_delta2_search would mistakenly access +beyond end of the main input read buffer. + +* src/kwset.c (bmexec_trans): When TP reaches or exceeds EP, +do not call bm_delta2_search. +* tests/kwset-abuse: New file. +* tests/Makefile.am (TESTS): Add it. +* NEWS (Bug fixes): Mention it. + +Prior to this patch, this command would trigger a UMR: + + printf %0360db 0 | valgrind src/grep -F $(printf %019dXb 0) + + Use of uninitialised value of size 8 + at 0x4142BE: bmexec_trans (kwset.c:657) + by 0x4143CA: bmexec (kwset.c:678) + by 0x414973: kwsexec (kwset.c:848) + by 0x414DC4: Fexecute (kwsearch.c:128) + by 0x404E2E: grepbuf (grep.c:1238) + by 0x4054BF: grep (grep.c:1417) + by 0x405CEB: grepdesc (grep.c:1645) + by 0x405EC1: grep_command_line_arg (grep.c:1692) + by 0x4077D4: main (grep.c:2570) + +See the accompanying test for how to trigger the heap buffer overrun. + +Thanks to Nima Aghdaii for testing and finding numerous +ways to break early iterations of this patch. + +Fixes CVE-2015-1345. +Upstream-Status: Backport + +--- +diff --git a/NEWS b/NEWS +index 975440d..3835d8d 100644 +--- a/NEWS ++++ b/NEWS +@@ -2,6 +2,11 @@ GNU grep NEWS -*- outline -*- + + * Noteworthy changes in release ?.? (????-??-??) [?] + ++** Bug fixes ++ ++ grep no longer reads from uninitialized memory or from beyond the end ++ of the heap-allocated input buffer. ++ + + * Noteworthy changes in release 2.21 (2014-11-23) [stable] + +diff --git a/src/kwset.c b/src/kwset.c +index 4003c8d..376f7c3 100644 +--- a/src/kwset.c ++++ b/src/kwset.c +@@ -643,6 +643,8 @@ bmexec_trans (kwset_t kwset, char const *text, size_t size) + if (! tp) + return -1; + tp++; ++ if (ep <= tp) ++ break; + } + } + } +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 2cba2cd..0508cd2 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -75,6 +75,7 @@ TESTS = \ + inconsistent-range \ + invalid-multibyte-infloop \ + khadafy \ ++ kwset-abuse \ + long-line-vs-2GiB-read \ + match-lines \ + max-count-overread \ +diff --git a/tests/kwset-abuse b/tests/kwset-abuse +new file mode 100755 +index 0000000..6d8ec0c +--- a/dev/null ++++ b/tests/kwset-abuse +@@ -0,0 +1,32 @@ ++#! /bin/sh ++# Evoke a segfault in a hard-to-reach code path of kwset.c. ++# This bug affected grep versions 2.19 through 2.21. ++# ++# Copyright (C) 2015 Free Software Foundation, Inc. ++# ++# This program is free software: you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation, either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see <http://www.gnu.org/licenses/>. ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../src ++ ++fail=0 ++ ++# This test case chooses a haystack of size 260,000, since prodding ++# with gdb showed a reallocation slightly larger than that in fillbuf. ++# To reach the buggy code, the needle must have length < 1/11 that of ++# the haystack, and 10,000 is a nice round number that fits the bill. ++printf '%0260000dXy\n' 0 | grep -F $(printf %010000dy 0) ++ ++test $? = 1 || fail=1 ++ ++Exit $fail +-- +cgit v0.9.0.2
meta/recipes-extended/grep/grep_2.19.bb +3 -1
@@ -5,7 +5,9 @@ SECTION = "console/utils" LICENSE = "GPLv3" LIC_FILES_CHKSUM = "file://COPYING;md5=8006d9c814277c1bfc4ca22af94b59ee" -SRC_URI = "${GNU_MIRROR}/grep/grep-${PV}.tar.xz" +SRC_URI = "${GNU_MIRROR}/grep/grep-${PV}.tar.xz \ + file://grep2.19-CVE-2015-1345.patch \ + " SRC_URI[md5sum] = "ac732142227d9fe9567d71301e127979" SRC_URI[sha256sum] = "6388295be48cfcaf7665d9cd3914e6625ea000e9414132bfefd45cf1d8eec34d"
Signature · 1 line
1.9.1
cover Dizzy-next
Please consider these changes for Dizzy-next
The following changes since commit 6d34267e0a13e10ab91b60590b27a2b5ba3b7da6:
documentation: Changed some 'intro' tags to resolve multiple mega-manual warnings. (2015-11-18 16:44:05 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib akuster/dizzy-next
http://git.yoctoproject.org/cgit.cgi//log/?h=akuster/dizzy-next
Armin Kuster (1):
openssh: CVE-2015-6563 CVE-2015-6564 CVE-2015-6565
Sergiy Kibrik (1):
rsync: backport libattr checking patch
Sona Sarmadi (2):
libtasn1: CVE-2015-3622
grep2.19: CVE-2015-1345
.../openssh/openssh/CVE-2015-6563.patch | 36 ++++++ .../openssh/openssh/CVE-2015-6564.patch | 34 ++++++ .../openssh/openssh/CVE-2015-6565.patch | 35 ++++++ meta/recipes-connectivity/openssh/openssh_6.6p1.bb | 5 +- .../rsync/files/check_libattr.patch | 33 ++++++ meta/recipes-devtools/rsync/rsync_3.1.0.bb | 3 +- .../grep/grep-2.19/grep2.19-CVE-2015-1345.patch | 129 +++++++++++++++++++++ meta/recipes-extended/grep/grep_2.19.bb | 4 +- .../gnutls/libtasn1/libtasn1-CVE-2015-3622.patch | 44 +++++++ meta/recipes-support/gnutls/libtasn1_4.0.bb | 1 + 10 files changed, 321 insertions(+), 3 deletions(-) create mode 100644 meta/recipes-connectivity/openssh/openssh/CVE-2015-6563.patch create mode 100644 meta/recipes-connectivity/openssh/openssh/CVE-2015-6564.patch create mode 100644 meta/recipes-connectivity/openssh/openssh/CVE-2015-6565.patch create mode 100644 meta/recipes-devtools/rsync/files/check_libattr.patch create mode 100644 meta/recipes-extended/grep/grep-2.19/grep2.19-CVE-2015-1345.patch create mode 100644 meta/recipes-support/gnutls/libtasn1/libtasn1-CVE-2015-3622.patch
Signature · 1 line
1.9.1
PATCH 1/4 libtasn1: CVE-2015-3622
From: Sona Sarmadi <[email protected]>
_asn1_extract_der_octet: prevent past of boundary access
References:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-3622
http://git.savannah.gnu.org/gitweb/?p=libtasn1.git;a=patch;
h=f979435823a02f842c41d49cd41cc81f25b5d677
--- .../gnutls/libtasn1/libtasn1-CVE-2015-3622.patch | 44 ++++++++++++++++++++++ meta/recipes-support/gnutls/libtasn1_4.0.bb | 1 + 2 files changed, 45 insertions(+) create mode 100644 meta/recipes-support/gnutls/libtasn1/libtasn1-CVE-2015-3622.patch
meta/recipes-support/gnutls/libtasn1/libtasn1-CVE-2015-3622.patch new file +44 -0
@@ -0,0 +1,44 @@ +From f979435823a02f842c41d49cd41cc81f25b5d677 Mon Sep 17 00:00:00 2001 +From: Nikos Mavrogiannopoulos <[email protected]> +Date: Mon, 20 Apr 2015 14:56:27 +0200 +Subject: [PATCH] _asn1_extract_der_octet: prevent past of boundary access + +Fixes CVE-2015-3622. +Upstream-Status: Backport + +Reported by Hanno Böck. +--- + lib/decoding.c | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/lib/decoding.c b/lib/decoding.c +index 7fbd931..42ddc6b 100644 +--- a/lib/decoding.c ++++ b/lib/decoding.c +@@ -732,6 +732,7 @@ _asn1_extract_der_octet (asn1_node node, const unsigned char *der, + return ASN1_DER_ERROR; + + counter = len3 + 1; ++ DECR_LEN(der_len, len3); + + if (len2 == -1) + counter_end = der_len - 2; +@@ -740,6 +741,7 @@ _asn1_extract_der_octet (asn1_node node, const unsigned char *der, + + while (counter < counter_end) + { ++ DECR_LEN(der_len, 1); + len2 = asn1_get_length_der (der + counter, der_len, &len3); + + if (IS_ERR(len2, flags)) +@@ -764,7 +766,6 @@ _asn1_extract_der_octet (asn1_node node, const unsigned char *der, + len2 = 0; + } + +- DECR_LEN(der_len, 1); + counter += len2 + len3 + 1; + } + +-- +1.7.2.5 +
meta/recipes-support/gnutls/libtasn1_4.0.bb +1 -0
@@ -11,6 +11,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \ SRC_URI = "${GNU_MIRROR}/libtasn1/libtasn1-${PV}.tar.gz \ file://libtasn1_fix_for_automake_1.12.patch \ file://dont-depend-on-help2man.patch \ + file://libtasn1-CVE-2015-3622.patch \ " SRC_URI[md5sum] = "d3d2d9bce3b6668b9827a9df52635be1"
Signature · 1 line
1.9.1
PATCH 3/4 rsync: backport libattr checking patch
In reply to Armin KusterFrom: Sergiy Kibrik <[email protected]>
Add check_libattr.patch to version 3.1.0 recipe, which checks and includes libattr to linker, otherwise rsync may fail to build with linker error below (as -lattr option gets omitted):
[..]lib/sysxattrs.o: undefined reference to symbol 'llistxattr@@ATTR_1.0' [..]/lib/libattr.so.1: error adding symbols: DSO missing from command line
--- .../rsync/files/check_libattr.patch | 33 ++++++++++++++++++++++ meta/recipes-devtools/rsync/rsync_3.1.0.bb | 3 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/rsync/files/check_libattr.patch
meta/recipes-devtools/rsync/files/check_libattr.patch new file +33 -0
@@ -0,0 +1,33 @@ +From 677c6e14cc7d5f41371d5616865a5f0cfc0a273f Mon Sep 17 00:00:00 2001 +From: Wayne Davison <[email protected]> +Date: Mon, 5 May 2014 09:25:13 -0700 +Subject: [PATCH] Check for attr lib. + +--- + configure.ac | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index c7b28c5..8e3703c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1007,7 +1007,7 @@ else + *) + AC_MSG_RESULT(running tests:) + AC_CHECK_LIB(acl,acl_get_file) +- AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[ ++ AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[ + AC_TRY_LINK([#include <sys/types.h> + #include <sys/acl.h>], + [ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);], +@@ -1057,6 +1057,7 @@ else + AC_DEFINE(HAVE_LINUX_XATTRS, 1, [True if you have Linux xattrs]) + AC_DEFINE(SUPPORT_XATTRS, 1) + AC_DEFINE(NO_SYMLINK_USER_XATTRS, 1, [True if symlinks do not support user xattrs]) ++ AC_CHECK_LIB(attr,getxattr) + ;; + darwin*) + AC_MSG_RESULT(Using OS X xattrs) +-- +1.9.1 +
meta/recipes-devtools/rsync/rsync_3.1.0.bb +2 -1
@@ -1,7 +1,8 @@ require rsync.inc -SRC_URI += "file://acinclude.m4" +SRC_URI += "file://acinclude.m4 \ + file://check_libattr.patch" SRC_URI[md5sum] = "3be148772a33224771a8d4d2a028b132" SRC_URI[sha256sum] = "81ca23f77fc9b957eb9845a6024f41af0ff0c619b7f38576887c63fa38e2394e"
Signature · 1 line
1.9.1
PATCH 4/4 openssh: CVE-2015-6563 CVE-2015-6564 CVE-2015-6565
In reply to Armin Kusterthree security fixes.
CVE-2015-6563 (Low) openssh: Privilege separation weakness related to PAM support CVE-2015-6564 (medium) openssh: Use-after-free bug related to PAM support CVE-2015-6565 (High) openssh: Incorrectly set TTYs to be world-writable
(From OE-Core rev: 259df232b513367a0a18b17e3e377260a770288f)
Conflicts:
meta/recipes-connectivity/openssh/openssh_6.6p1.bb
--- .../openssh/openssh/CVE-2015-6563.patch | 36 ++++++++++++++++++++++ .../openssh/openssh/CVE-2015-6564.patch | 34 ++++++++++++++++++++ .../openssh/openssh/CVE-2015-6565.patch | 35 +++++++++++++++++++++ meta/recipes-connectivity/openssh/openssh_6.6p1.bb | 5 ++- 4 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-connectivity/openssh/openssh/CVE-2015-6563.patch create mode 100644 meta/recipes-connectivity/openssh/openssh/CVE-2015-6564.patch create mode 100644 meta/recipes-connectivity/openssh/openssh/CVE-2015-6565.patch
meta/recipes-connectivity/openssh/openssh/CVE-2015-6563.patch new file +36 -0
@@ -0,0 +1,36 @@ +CVE-2015-6563 + +Don't resend username to PAM; it already has it. +Pointed out by Moritz Jodeit; ok dtucker@ + +Upstream-Status: Backport +https://github.com/openssh/openssh-portable/commit/d4697fe9a28dab7255c60433e4dd23cf7fce8a8b + +Signed-off-by: Armin Kuster <[email protected]> + +Index: openssh-6.7p1/monitor.c +=================================================================== +--- openssh-6.7p1.orig/monitor.c ++++ openssh-6.7p1/monitor.c +@@ -1046,9 +1046,7 @@ extern KbdintDevice sshpam_device; + int + mm_answer_pam_init_ctx(int sock, Buffer *m) + { +- + debug3("%s", __func__); +- authctxt->user = buffer_get_string(m, NULL); + sshpam_ctxt = (sshpam_device.init_ctx)(authctxt); + sshpam_authok = NULL; + buffer_clear(m); +Index: openssh-6.7p1/monitor_wrap.c +=================================================================== +--- openssh-6.7p1.orig/monitor_wrap.c ++++ openssh-6.7p1/monitor_wrap.c +@@ -826,7 +826,6 @@ mm_sshpam_init_ctx(Authctxt *authctxt) + + debug3("%s", __func__); + buffer_init(&m); +- buffer_put_cstring(&m, authctxt->user); + mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_INIT_CTX, &m); + debug3("%s: waiting for MONITOR_ANS_PAM_INIT_CTX", __func__); + mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PAM_INIT_CTX, &m);
meta/recipes-connectivity/openssh/openssh/CVE-2015-6564.patch new file +34 -0
@@ -0,0 +1,34 @@ +CVE-2015-6564 + + set sshpam_ctxt to NULL after free + + Avoids use-after-free in monitor when privsep child is compromised. + Reported by Moritz Jodeit; ok dtucker@ + +Upstream-Status: Backport +https://github.com/openssh/openssh-portable/commit/5e75f5198769056089fb06c4d738ab0e5abc66f7 + +Signed-off-by: Armin Kuster <[email protected]> + +Index: openssh-6.7p1/monitor.c +=================================================================== +--- openssh-6.7p1.orig/monitor.c ++++ openssh-6.7p1/monitor.c +@@ -1128,14 +1128,16 @@ mm_answer_pam_respond(int sock, Buffer * + int + mm_answer_pam_free_ctx(int sock, Buffer *m) + { ++ int r = sshpam_authok != NULL && sshpam_authok == sshpam_ctxt; + + debug3("%s", __func__); + (sshpam_device.free_ctx)(sshpam_ctxt); ++ sshpam_ctxt = sshpam_authok = NULL; + buffer_clear(m); + mm_request_send(sock, MONITOR_ANS_PAM_FREE_CTX, m); + auth_method = "keyboard-interactive"; + auth_submethod = "pam"; +- return (sshpam_authok == sshpam_ctxt); ++ return r; + } + #endif +
meta/recipes-connectivity/openssh/openssh/CVE-2015-6565.patch new file +35 -0
@@ -0,0 +1,35 @@ +CVE-2015-6565 openssh: Incorrectly set TTYs to be world-writable + +fix pty permissions; patch from Nikolay Edigaryev; ok deraadt + +Upstream-Status: Backport + +merged two changes into one. +[1] https://anongit.mindrot.org/openssh.git/commit/sshpty.c?id=a5883d4eccb94b16c355987f58f86a7dee17a0c2 +tighten permissions on pty when the "tty" group does not exist; pointed out by Corinna Vinschen; ok markus + +[2] https://anongit.mindrot.org/openssh.git/commit/sshpty.c?id=6f941396b6835ad18018845f515b0c4fe20be21a +fix pty permissions; patch from Nikolay Edigaryev; ok deraadt + +Signed-off-by: Armin Kuster <[email protected]> + +Index: openssh-6.7p1/sshpty.c +=================================================================== +--- openssh-6.7p1.orig/sshpty.c ++++ openssh-6.7p1/sshpty.c +@@ -196,13 +196,8 @@ pty_setowner(struct passwd *pw, const ch + + /* Determine the group to make the owner of the tty. */ + grp = getgrnam("tty"); +- if (grp) { +- gid = grp->gr_gid; +- mode = S_IRUSR | S_IWUSR | S_IWGRP; +- } else { +- gid = pw->pw_gid; +- mode = S_IRUSR | S_IWUSR | S_IWGRP | S_IWOTH; +- } ++ gid = (grp != NULL) ? grp->gr_gid : pw->pw_gid; ++ mode = (grp != NULL) ? 0620 : 0600; + + /* + * Change owner and mode of the tty as required.
meta/recipes-connectivity/openssh/openssh_6.6p1.bb +4 -1
@@ -25,7 +25,10 @@ SRC_URI = "ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar. file://run-ptest \ file://openssh-CVE-2014-2532.patch \ file://openssh-CVE-2014-2653.patch \ - file://auth2-none.c-avoid-authenticate-empty-passwords-to-m.patch" + file://CVE-2015-6563.patch \ + file://CVE-2015-6564.patch \ + file://CVE-2015-6565.patch \ + " PAM_SRC_URI = "file://sshd"
Signature · 1 line
1.9.1