Fix security related bugs
cover Fix security related bugs
Fixes a number of security related bugs for daisy branch.
Sona Sarmadi (5):
Qemu: CVE-2014-2894
libpng16: CVE-2015-0973
coreutils: parse-datetime: CVE-2014-9471
elfutils: CVE-2014-9447
e2fsprogs: CVE-2015-0247
.../parse-datetime-CVE-2014-9471.patch | 43 ++++++++++++++++ meta/recipes-core/coreutils/coreutils_8.22.bb | 1 + .../e2fsprogs/e2fsprogs/CVE-2015-0247.patch | 58 ++++++++++++++++++++++ .../recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb | 1 + .../elfutils/elfutils/CVE-2014-9447.patch | 50 +++++++++++++++++++ meta/recipes-devtools/elfutils/elfutils_0.155.bb | 1 + .../qemu/files/ide-CVE-2014-2894.patch | 46 +++++++++++++++++ meta/recipes-devtools/qemu/qemu_1.7.0.bb | 3 +- .../libpng/libpng/libpng16-CVE-2015-0973.patch | 47 ++++++++++++++++++ meta/recipes-multimedia/libpng/libpng_1.6.8.bb | 1 + 10 files changed, 250 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-core/coreutils/coreutils-8.22/parse-datetime-CVE-2014-9471.patch create mode 100644 meta/recipes-devtools/e2fsprogs/e2fsprogs/CVE-2015-0247.patch create mode 100644 meta/recipes-devtools/elfutils/elfutils/CVE-2014-9447.patch create mode 100644 meta/recipes-devtools/qemu/files/ide-CVE-2014-2894.patch create mode 100644 meta/recipes-multimedia/libpng/libpng/libpng16-CVE-2015-0973.patch
Signature · 1 line
1.9.1
PATCH 1/5 Qemu: CVE-2014-2894
From: Sona Sarmadi <[email protected]>
Fixes an out of bounds memory access flaw
in Qemu's IDE device model
Reference
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-2894
--- .../qemu/files/ide-CVE-2014-2894.patch | 46 ++++++++++++++++++++++ meta/recipes-devtools/qemu/qemu_1.7.0.bb | 3 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/qemu/files/ide-CVE-2014-2894.patch
meta/recipes-devtools/qemu/files/ide-CVE-2014-2894.patch new file +46 -0
@@ -0,0 +1,46 @@ +From c5dae2f4c50ef848f224da718154af4438862cdb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Beno=C3=AEt=20Canet?= <[email protected]> +Date: Sat, 12 Apr 2014 22:59:50 +0200 +Subject: [PATCH] ide: Correct improper smart self test counter reset in ide + core. + +The SMART self test counter was incorrectly being reset to zero, +not 1. This had the effect that on every 21st SMART EXECUTE OFFLINE: + * We would write off the beginning of a dynamically allocated buffer + * We forgot the SMART history +Fix this. + +Signed-off-by: Benoit Canet <[email protected]> +Message-id: [email protected] +Reviewed-by: Markus Armbruster <[email protected]> +Cc: [email protected] +Acked-by: Kevin Wolf <[email protected]> +[PMM: tweaked commit message as per suggestions from Markus] +Signed-off-by: Peter Maydell <[email protected]> + +Fixes CVE-2014-2894 +Upstream-Status: Backport + +(cherry picked from commit 940973ae0b45c9b6817bab8e4cf4df99a9ef83d7) +Signed-off-by: Michael Roth <[email protected]> +Signed-off-by: Sona Sarmadi <[email protected]> +--- + hw/ide/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/ide/core.c b/hw/ide/core.c +index e1f4c33..6007f6f 100644 +--- a/hw/ide/core.c ++++ b/hw/ide/core.c +@@ -1601,7 +1601,7 @@ static bool cmd_smart(IDEState *s, uint8_t cmd) + case 2: /* extended self test */ + s->smart_selftest_count++; + if (s->smart_selftest_count > 21) { +- s->smart_selftest_count = 0; ++ s->smart_selftest_count = 1; + } + n = 2 + (s->smart_selftest_count - 1) * 24; + s->smart_selftest_data[n] = s->sector; +-- +1.9.1 +
meta/recipes-devtools/qemu/qemu_1.7.0.bb +2 -1
@@ -5,7 +5,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ SRC_URI += "file://fxrstorssefix.patch \ file://qemu-enlarge-env-entry-size.patch \ - file://Qemu-Arm-versatilepb-Add-memory-size-checking.patch" + file://Qemu-Arm-versatilepb-Add-memory-size-checking.patch \ + file://ide-CVE-2014-2894.patch" SRC_URI_prepend = "http://wiki.qemu.org/download/qemu-${PV}.tar.bz2" SRC_URI[md5sum] = "32893941d40d052a5e649efcf06aca06"
Signature · 1 line
1.9.1
PATCH 2/5 libpng16: CVE-2015-0973
In reply to Maxin B. JohnFrom: Sona Sarmadi <[email protected]>
Fixes CVE-2015-0973 (duplicate of CVE-2014-9495), a heap-based overflow vulnerability in the png_combine_row() function of the libpng library, when very large interlaced images were used.
Upstream patch:
http://sourceforge.net/p/libpng/code/ci/dc294204b641373bc6eb603075a8b98f51a75dd8/
External Reference:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-0973
http://seclists.org/oss-sec/2014/q4/1133
--- .../libpng/libpng/libpng16-CVE-2015-0973.patch | 47 ++++++++++++++++++++++ meta/recipes-multimedia/libpng/libpng_1.6.8.bb | 1 + 2 files changed, 48 insertions(+) create mode 100644 meta/recipes-multimedia/libpng/libpng/libpng16-CVE-2015-0973.patch
meta/recipes-multimedia/libpng/libpng/libpng16-CVE-2015-0973.patch new file +47 -0
@@ -0,0 +1,47 @@ +libpng16: Fixed an overflow in png_combine_row with very wide interlaced + +Fixes CVE-2015-0973 (duplicate of CVE-2014-9495), a heap-based overflow +vulnerability in the png_combine_row() function of the libpng library, +when very large interlaced images were used. + +Upstream patch: +http://sourceforge.net/p/libpng/code/ci/dc294204b641373bc6eb603075a8b98f51a75dd8/ + +Upstream-Status: Backport + +Signed-off-by: Sona Sarmadi <[email protected]> +--- +diff --git a/pngrutil.c b/pngrutil.c +index e9fdd62..4c26be4 100644 +--- a/pngrutil.c ++++ b/pngrutil.c +@@ -3003,7 +3003,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) + { + unsigned int pixel_depth = png_ptr->transformed_pixel_depth; + png_const_bytep sp = png_ptr->row_buf + 1; +- png_uint_32 row_width = png_ptr->width; ++ png_alloc_size_t row_width = png_ptr->width; + unsigned int pass = png_ptr->pass; + png_bytep end_ptr = 0; + png_byte end_byte = 0; +@@ -3278,7 +3278,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) + + /* But don't allow this number to exceed the actual row width. */ + if (bytes_to_copy > row_width) +- bytes_to_copy = row_width; ++ bytes_to_copy = (unsigned int)/*SAFE*/row_width; + } + + else /* normal row; Adam7 only ever gives us one pixel to copy. */ +@@ -3458,7 +3458,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) + dp += bytes_to_jump; + row_width -= bytes_to_jump; + if (bytes_to_copy > row_width) +- bytes_to_copy = row_width; ++ bytes_to_copy = (unsigned int)/*SAFE*/row_width; + } + } + +-- +1.9.1 +
meta/recipes-multimedia/libpng/libpng_1.6.8.bb +1 -0
@@ -10,6 +10,7 @@ LIBV = "16" SRC_URI = "${SOURCEFORGE_MIRROR}/project/libpng/libpng${LIBV}/${PV}/libpng-${PV}.tar.xz \ file://0001-configure-lower-automake-requirement.patch \ + file://libpng16-CVE-2015-0973.patch \ " SRC_URI[md5sum] = "51ce71a1642cdde1f4485a7ff82193c0"
Signature · 1 line
1.9.1
PATCH 3/5 coreutils: parse-datetime: CVE-2014-9471
In reply to Maxin B. JohnFrom: Sona Sarmadi <[email protected]>
Memory corruption flaw in parse_datetime()
Reference
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-9471
--- .../parse-datetime-CVE-2014-9471.patch | 43 ++++++++++++++++++++++ meta/recipes-core/coreutils/coreutils_8.22.bb | 1 + 2 files changed, 44 insertions(+) create mode 100644 meta/recipes-core/coreutils/coreutils-8.22/parse-datetime-CVE-2014-9471.patch
meta/recipes-core/coreutils/coreutils-8.22/parse-datetime-CVE-2014-9471.patch new file +43 -0
@@ -0,0 +1,43 @@ +Upstream-Status: Backport +Signed-off-by: Sona Sarmadi <[email protected]> +--- +diff -ruN a/ChangeLog b/ChangeLog +--- a/ChangeLog 2013-12-13 16:20:00.000000000 +0100 ++++ b/ChangeLog 2015-02-26 09:24:10.640577829 +0100 +@@ -1,3 +1,11 @@ ++2014-02-25 Sona Sarmadi <[email protected]> ++ ++ parse-datetime: fix crash or infloop in TZ="" parsing ++ * lib/parse-datetime.y (parse_datetime): Break out of the ++ TZ="" parsing loop once the second significant " is found. ++ Also skip over any subsequent whitespace to be consistent ++ with the non TZ= case (CVE-2014-9471) ++ + 2013-12-13 Pádraig Brady <[email protected]> + + version 8.22 +diff -ruN a/lib/parse-datetime.y b/lib/parse-datetime.y +--- a/lib/parse-datetime.y 2013-12-04 15:53:33.000000000 +0100 ++++ b/lib/parse-datetime.y 2015-02-26 09:20:15.238528670 +0100 +@@ -1303,8 +1303,6 @@ + char tz1buf[TZBUFSIZE]; + bool large_tz = TZBUFSIZE < tzsize; + bool setenv_ok; +- /* Free tz0, in case this is the 2nd or subsequent time through. */ +- free (tz0); + tz0 = get_tz (tz0buf); + z = tz1 = large_tz ? xmalloc (tzsize) : tz1buf; + for (s = tzbase; *s != '"'; s++) +@@ -1316,7 +1314,12 @@ + if (!setenv_ok) + goto fail; + tz_was_altered = true; ++ + p = s + 1; ++ while (c = *p, c_isspace (c)) ++ p++; ++ ++ break; + } + } +
meta/recipes-core/coreutils/coreutils_8.22.bb +1 -0
@@ -16,6 +16,7 @@ SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz \ file://remove-usr-local-lib-from-m4.patch \ file://dummy_help2man.patch \ file://fix-for-dummy-man-usage.patch \ + file://parse-datetime-CVE-2014-9471.patch \ " SRC_URI[md5sum] = "8fb0ae2267aa6e728958adc38f8163a2"
Signature · 1 line
1.9.1
PATCH 4/5 elfutils: CVE-2014-9447
In reply to Maxin B. JohnFrom: Sona Sarmadi <[email protected]>
directory traversal in read_long_names()
Reference
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-9447
Upstream commit with the analysis:
https://git.fedorahosted.org/cgit/elfutils.git/commit/?id=147018e729e7c22eeabf15b82d26e4bf68a0d18e
--- .../elfutils/elfutils/CVE-2014-9447.patch | 50 ++++++++++++++++++++++ meta/recipes-devtools/elfutils/elfutils_0.155.bb | 1 + 2 files changed, 51 insertions(+) create mode 100644 meta/recipes-devtools/elfutils/elfutils/CVE-2014-9447.patch
meta/recipes-devtools/elfutils/elfutils/CVE-2014-9447.patch new file +50 -0
@@ -0,0 +1,50 @@ +libelf: Fix dir traversal vuln in ar extraction. + +read_long_names terminates names at the first '/' found but then skips one +character without checking (it's supposed to be '\n'). Hence the next name could +start with any character including '/'. This leads to a directory traversal +vulnerability at the time the contents of the archive is extracted. + +The danger is mitigated by the fact that only one '/' is possible in a resulting +filename +and only in the leading position. Hence only files in the root directory can be +written via this vuln and only when ar is executed as root. The fix for the vuln +is to not skip any characters while looking for '/'. + +Upstream commit: +https://git.fedorahosted.org/cgit/elfutils.git/commit/ +?id=147018e729e7c22eeabf15b82d26e4bf68a0d18e + +Fixes CVE-2014-9447 +Upstream-Status: Backport + +Signed-off-by: Alexander Cherepanov <[email protected]> +Signed-off-by: Sona Sarmadi <[email protected]> +--- +diff -ruN a/libelf/ChangeLog b/libelf/ChangeLog +--- a/libelf/ChangeLog 2015-03-03 12:39:39.255277970 +0100 ++++ b/libelf/ChangeLog 2015-03-03 12:43:44.700870042 +0100 +@@ -1,3 +1,8 @@ ++2014-12-28 Alexander Cherepanov <[email protected]> ++ ++ * elf_begin.c (read_long_names): Don't miss '/' right after ++ another '/'. Fixes a dir traversal vuln in ar extraction. ++ + 2012-08-16 Roland McGrath <[email protected]> + + * elf.h: Update from glibc. +diff -ruN a/libelf/elf_begin.c b/libelf/elf_begin.c +--- a/libelf/elf_begin.c 2015-03-03 12:39:39.835253375 +0100 ++++ b/libelf/elf_begin.c 2015-03-03 12:41:30.906543370 +0100 +@@ -744,10 +744,7 @@ + break; + + /* NUL-terminate the string. */ +- *runp = '\0'; +- +- /* Skip the NUL byte and the \012. */ +- runp += 2; ++ *runp++ = '\0'; + + /* A sanity check. Somebody might have generated invalid + archive. */
meta/recipes-devtools/elfutils/elfutils_0.155.bb +1 -0
@@ -23,6 +23,7 @@ SRC_URI += "\ file://nm-Fix-size-passed-to-snprintf-for-invalid-sh_name-case.patch \ file://elfutils-ar-c-fix-num-passed-to-memset.patch \ file://fix-build-gcc-4.8.patch \ + file://CVE-2014-9447.patch \ " # Only apply when building uclibc based target recipe SRC_URI_append_libc-uclibc = " file://uclibc-support.patch"
Signature · 1 line
1.9.1
PATCH 5/5 e2fsprogs: CVE-2015-0247
In reply to Maxin B. JohnFrom: Sona Sarmadi <[email protected]>
Fixes input sanitization errors.
References
http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/commit/?id=f66e6ce4
http://www.ocert.org/advisories/ocert-2015-002.html
--- .../e2fsprogs/e2fsprogs/CVE-2015-0247.patch | 58 ++++++++++++++++++++++ .../recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb | 1 + 2 files changed, 59 insertions(+) create mode 100644 meta/recipes-devtools/e2fsprogs/e2fsprogs/CVE-2015-0247.patch
meta/recipes-devtools/e2fsprogs/e2fsprogs/CVE-2015-0247.patch new file +58 -0
@@ -0,0 +1,58 @@ +From f66e6ce4446738c2c7f43d41988a3eb73347e2f5 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o <[email protected]> +Date: Sat, 9 Aug 2014 12:24:54 -0400 +Subject: libext2fs: avoid buffer overflow if s_first_meta_bg is too big + +If s_first_meta_bg is greater than the of number block group +descriptor blocks, then reading or writing the block group descriptors +will end up overruning the memory buffer allocated for the +descriptors. Fix this by limiting first_meta_bg to no more than +fs->desc_blocks. This doesn't correct the bad s_first_meta_bg value, +but it avoids causing the e2fsprogs userspace programs from +potentially crashing. + +Fixes CVE-2015-0247 +Upstream-Status: Backport + +Signed-off-by: Theodore Ts'o <[email protected]> +Signed-off-by: Sona Sarmadi <[email protected]> + +diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c +index 4599eef..1f99113 100644 +--- a/lib/ext2fs/closefs.c ++++ b/lib/ext2fs/closefs.c +@@ -344,9 +344,11 @@ errcode_t ext2fs_flush2(ext2_filsys fs, int flags) + * superblocks and group descriptors. + */ + group_ptr = (char *) group_shadow; +- if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) ++ if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) { + old_desc_blocks = fs->super->s_first_meta_bg; +- else ++ if (old_desc_blocks > fs->super->s_first_meta_bg) ++ old_desc_blocks = fs->desc_blocks; ++ } else + old_desc_blocks = fs->desc_blocks; + + ext2fs_numeric_progress_init(fs, &progress, NULL, +diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c +index a1a3517..ba501e6 100644 +--- a/lib/ext2fs/openfs.c ++++ b/lib/ext2fs/openfs.c +@@ -378,9 +378,11 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, + #ifdef WORDS_BIGENDIAN + groups_per_block = EXT2_DESC_PER_BLOCK(fs->super); + #endif +- if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) ++ if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) { + first_meta_bg = fs->super->s_first_meta_bg; +- else ++ if (first_meta_bg > fs->desc_blocks) ++ first_meta_bg = fs->desc_blocks; ++ } else + first_meta_bg = fs->desc_blocks; + if (first_meta_bg) { + retval = io_channel_read_blk(fs->io, group_block + +-- +cgit v0.10.2 +
meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb +1 -0
@@ -18,6 +18,7 @@ SRC_URI += "file://acinclude.m4 \ file://0011-mke2fs.8.in-update-the-manual-for-the-d-option.patch \ file://0001-e2fsprogs-fix-cross-compilation-problem.patch \ file://misc-mke2fs.c-return-error-when-failed-to-populate-fs.patch \ + file://CVE-2015-0247.patch \ " SRC_URI[md5sum] = "3f8e41e63b432ba114b33f58674563f7"
Signature · 1 line
1.9.1