Skip to contentSkip to conversation

busybox: CVE-2017-15874

PATCH Superseded Sinan Kaya 3 participants 7 messages Sep 21, 2018 – Sep 22, 2018

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Sinan Kaya

author
#0 lore raw

PATCH 1/3 busybox: CVE-2017-15874

* CVE-2017-15874
busybox: Integer underflow in archival/libarchive/decompress_unlzma.c

(cherry picked from 9ac42c500586fa5f10a1f6d22c3f797df11b1f6b)

Affects busybox <= 1.27.2

Upstream-Status: Backport [ https://git.busybox.net/busybox/commit/?id=9ac42c500586fa5f10a1f6d22c3f797df11b1f6b]
CVE: CVE-2017-15874
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2017-15874

---
 .../busybox/busybox/CVE-2017-15874.patch      | 28 +++++++++++++++++++
 meta/recipes-core/busybox/busybox_1.27.2.bb   |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 meta/recipes-core/busybox/busybox/CVE-2017-15874.patch
meta/recipes-core/busybox/busybox/CVE-2017-15874.patch new file +28 -0
new file mode 100644
index 0000000000..dece92c160
@@ -0,0 +1,28 @@
+From e75c01bb3249df16201b482b79bb24bec3b58188 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <[email protected]>
+Date: Fri, 27 Oct 2017 15:37:03 +0200
+Subject: [PATCH] unlzma: fix SEGV, closes 10436
+
+Signed-off-by: Denys Vlasenko <[email protected]>
+---
+ archival/libarchive/decompress_unlzma.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/archival/libarchive/decompress_unlzma.c b/archival/libarchive/decompress_unlzma.c
+index 29eee2a..41e492f 100644
+--- a/archival/libarchive/decompress_unlzma.c
++++ b/archival/libarchive/decompress_unlzma.c
+@@ -353,6 +353,10 @@ unpack_lzma_stream(transformer_state_t *xstate)
+ 						pos = buffer_pos - rep0;
+ 						if ((int32_t)pos < 0) {
+ 							pos += header.dict_size;
++							/* bug 10436 has an example file where this triggers: */
++							if ((int32_t)pos < 0)
++								goto bad;
++
+ 							/* see unzip_bad_lzma_2.zip: */
+ 							if (pos >= buffer_size)
+ 								goto bad;
+-- 
+2.19.0
+
meta/recipes-core/busybox/busybox_1.27.2.bb +1 -0
index 1ce4823d47..bab29728ee 100644
@@ -47,6 +47,7 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
            file://busybox-CVE-2017-16544.patch \
            file://busybox-fix-lzma-segfaults.patch \
            file://umount-ignore-c.patch \
+           file://CVE-2017-15874.patch \
 "
 SRC_URI_append_libc-musl = " file://musl.cfg "
 
Signature · 1 line
2.19.0
author
#1 lore raw

PATCH 2/3 libpng: CVE-2018-13785

* CVE-2018-13785
In libpng 1.6.34, a wrong calculation of row_factor in the png_check_chunk_length function (pngrutil.c) may trigger an integer overflow and resultant divide-by-zero while processing a crafted PNG file, leading to a denial of service.

(cherry picked from 8a05766cb74af05c04c53e6c9d60c13fc4d59bf2)

Affects libpng <= 1.6.34

CVE: CVE-2018-13785
Upstream-Status: Backport [https://github.com/glennrp/libpng/commit/8a05766cb74af05c04c53e6c9d60c13fc4d59bf2]
Ref: https://access.redhat.com/security/cve/cve-2018-13785

---
 .../libpng/files/CVE-2018-13785.patch         | 35 +++++++++++++++++++
 .../libpng/libpng_1.6.34.bb                   |  4 ++-
 2 files changed, 38 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-multimedia/libpng/files/CVE-2018-13785.patch
meta/recipes-multimedia/libpng/files/CVE-2018-13785.patch new file +35 -0
new file mode 100644
index 0000000000..3ffbe0813e
@@ -0,0 +1,35 @@
+From 8a05766cb74af05c04c53e6c9d60c13fc4d59bf2 Mon Sep 17 00:00:00 2001
+From: Cosmin Truta <[email protected]>
+Date: Sun, 17 Jun 2018 22:56:29 -0400
+Subject: [PATCH] [libpng16] Fix the calculation of row_factor in
+ png_check_chunk_length
+
+(Bug report by Thuan Pham, SourceForge issue #278)
+---
+ pngrutil.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/pngrutil.c b/pngrutil.c
+index 95571b517..5ba995abf 100644
+--- a/pngrutil.c
++++ b/pngrutil.c
+@@ -3167,10 +3167,13 @@ png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length)
+    {
+       png_alloc_size_t idat_limit = PNG_UINT_31_MAX;
+       size_t row_factor =
+-         (png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1)
+-          + 1 + (png_ptr->interlaced? 6: 0));
++         (size_t)png_ptr->width
++         * (size_t)png_ptr->channels
++         * (png_ptr->bit_depth > 8? 2: 1)
++         + 1
++         + (png_ptr->interlaced? 6: 0);
+       if (png_ptr->height > PNG_UINT_32_MAX/row_factor)
+-         idat_limit=PNG_UINT_31_MAX;
++         idat_limit = PNG_UINT_31_MAX;
+       else
+          idat_limit = png_ptr->height * row_factor;
+       row_factor = row_factor > 32566? 32566 : row_factor;
+-- 
+2.19.0
+
meta/recipes-multimedia/libpng/libpng_1.6.34.bb +3 -1
index e52d032289..3877d6cbf0 100644
@@ -8,7 +8,9 @@ DEPENDS = "zlib"
 
 LIBV = "16"
 
-SRC_URI = "${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}${LIBV}/${PV}/${BP}.tar.xz"
+SRC_URI = "${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}${LIBV}/${PV}/${BP}.tar.xz \
+           file://CVE-2018-13785.patch \
+"
 SRC_URI[md5sum] = "c05b6ca7190a5e387b78657dbe5536b2"
 SRC_URI[sha256sum] = "2f1e960d92ce3b3abd03d06dfec9637dfbd22febf107a536b44f7a47c60659f6"
 
Signature · 1 line
2.19.0
author
#2 lore raw

PATCH 3/3 sqlite3: CVE-2018-8740

In reply to Sinan Kaya

* CVE-2018-8740
In SQLite through 3.22.0, databases whose schema is corrupted using a CREATE TABLE AS statement could cause a NULL pointer dereference, related to build.c and prepare.c.

Affects sqlite3 <= 3.22.0

Upstream-Status: Backport [ https://www.sqlite.org/cgi/src/vdiff?from=1774f1c3baf0bc3d&to=d75e67654aa9620b&diff=1&w]
CVE: CVE-2018-8740
Ref: https://access.redhat.com/security/cve/cve-2018-8740

---
 .../sqlite/files/CVE-2018-8740.patch          | 52 +++++++++++++++++++
 meta/recipes-support/sqlite/sqlite3_3.22.0.bb |  1 +
 2 files changed, 53 insertions(+)
 create mode 100644 meta/recipes-support/sqlite/files/CVE-2018-8740.patch
meta/recipes-support/sqlite/files/CVE-2018-8740.patch new file +52 -0
new file mode 100644
index 0000000000..7cec1f489c
@@ -0,0 +1,52 @@
+From 19aed4d2be46c4516caf2bee31f79044bbd1d57d Mon Sep 17 00:00:00 2001
+From: Sinan Kaya <[email protected]>
+Date: Fri, 21 Sep 2018 16:22:01 +0000
+Subject: [PATCH] sqlite3: CVE-2018-8740
+
+port from:
+https://www.sqlite.org/cgi/src/vdiff?from=1774f1c3baf0bc3d&to=d75e67654aa9620b&diff=1&w
+
+CVE detail:
+https://nvd.nist.gov/vuln/detail/CVE-2018-8740
+
+Signed-off-by: Sinan Kaya <[email protected]>
+---
+ sqlite3.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/sqlite3.c b/sqlite3.c
+index 73c69ef..6863bc6 100644
+--- a/sqlite3.c
++++ b/sqlite3.c
+@@ -103474,8 +103474,6 @@ SQLITE_PRIVATE void sqlite3EndTable(
+   p = pParse->pNewTable;
+   if( p==0 ) return;
+ 
+-  assert( !db->init.busy || !pSelect );
+-
+   /* If the db->init.busy is 1 it means we are reading the SQL off the
+   ** "sqlite_master" or "sqlite_temp_master" table on the disk.
+   ** So do not write to the disk again.  Extract the root page number
+@@ -103486,6 +103484,10 @@ SQLITE_PRIVATE void sqlite3EndTable(
+   ** table itself.  So mark it read-only.
+   */
+   if( db->init.busy ){
++    if( pSelect ){
++     sqlite3ErrorMsg(pParse, "");
++     return;
++    }
+     p->tnum = db->init.newTnum;
+     if( p->tnum==1 ) p->tabFlags |= TF_Readonly;
+   }
+@@ -117813,7 +117815,7 @@ static void corruptSchema(
+     char *z;
+     if( zObj==0 ) zObj = "?";
+     z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj);
+-    if( zExtra ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra);
++    if( zExtra && zExtra[0] ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra);
+     sqlite3DbFree(db, *pData->pzErrMsg);
+     *pData->pzErrMsg = z;
+   }
+-- 
+2.19.0
+
meta/recipes-support/sqlite/sqlite3_3.22.0.bb +1 -0
index ef88659e97..b90f89886a 100644
@@ -5,6 +5,7 @@ LIC_FILES_CHKSUM = "file://sqlite3.h;endline=11;md5=786d3dc581eff03f4fd9e4a77ed0
 
 SRC_URI = "\
   http://www.sqlite.org/2018/sqlite-autoconf-${SQLITE_PV}.tar.gz \
+  file://CVE-2018-8740.patch \
   "
 SRC_URI[md5sum] = "96b5648d542e8afa6ab7ffb8db8ddc3d"
 SRC_URI[sha256sum] = "2824ab1238b706bc66127320afbdffb096361130e23291f26928a027b885c612"
Signature · 1 line
2.19.0
#3 lore raw

✗ patchtest: failure for "[v1] busybox: CVE-2017-15874..." and 2 more

In reply to Sinan Kaya

== Series Details ==

Series: "[v1] busybox: CVE-2017-15874..." and 2 more
Revision: 1
URL : https://patchwork.openembedded.org/series/14184/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 957a2f95b8)

* Issue A patch file has been added, but does not have a Signed-off-by tag [test_signed_off_by_presence]
Suggested fix Sign off the added patch file (meta/recipes-multimedia/libpng/files/CVE-2018-13785.patch)

* Issue Added patch file is missing Upstream-Status in the header [test_upstream_status_presence_format]

  Suggested fix    Add Upstream-Status: <Valid status> to the header of meta/recipes-core/busybox/busybox/CVE-2017-15874.patch
  Standard format  Upstream-Status: <Valid status>
  Valid status     Pending, Accepted, Backport, Denied, Inappropriate [reason], Submitted [where]

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
author
#4 lore raw

Re: ✗ patchtest: failure for "[v1] busybox: CVE-2017-15874..." and 2 more

Quoted 16 lines · Patchwork

== Series Details ==

Series: "[v1] busybox: CVE-2017-15874..." and 2 more
Revision: 1
URL : https://patchwork.openembedded.org/series/14184/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

Quoted 4 lines
* Issue             Series does not apply on top of target branch [test_series_merge_on_head]
   Suggested fix    Rebase your series on top of targeted branch
   Targeted branch  master (currently at 957a2f95b8)

These patches do not apply to the master branch because they were intended for the sumo branch as a security fix. Is there a way to specify what particular branch this patch is targeting?

Another reason is that package versions on master branch are newer.

Quoted 3 lines

* Issue A patch file has been added, but does not have a Signed-off-by tag [test_signed_off_by_presence]
Suggested fix Sign off the added patch file (meta/recipes-multimedia/libpng/files/CVE-2018-13785.patch)

the original patch doesn't have a signed-off. What's the policy?

Quoted 5 lines
* Issue             Added patch file is missing Upstream-Status in the header [test_upstream_status_presence_format]
   Suggested fix    Add Upstream-Status: <Valid status> to the header of meta/recipes-core/busybox/busybox/CVE-2017-15874.patch
   Standard format  Upstream-Status: <Valid status>
   Valid status     Pending, Accepted, Backport, Denied, Inappropriate [reason], Submitted [where]

I'm fairly new to this. I believe I have this tag. Do I have a mistake?

commit b3761a1a9b05c97028034a44be27400114ccf526

Author: Sinan Kaya <[email protected]>
Date:   Fri Sep 21 04:20:44 2018 +0000

busybox: CVE-2017-15874

* CVE-2017-15874
busybox: Integer underflow in archival/libarchive/decompress_unlzma.c

(cherry picked from 9ac42c500586fa5f10a1f6d22c3f797df11b1f6b)

Affects busybox <= 1.27.2

Upstream-Status: Backport [
https://git.busybox.net/busybox/commit/?id=9ac42c500586fa5f10a1f6d22c3f797df11b1f6b]

    CVE: CVE-2017-15874
    Ref: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2017-15874
    Signed-off-by: Sinan Kaya <[email protected]>
Quoted 15 lines

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
#5 lore raw

Re: ✗ patchtest: failure for "[v1] busybox: CVE-2017-15874..." and 2 more

Quoted 26 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Sinan Kaya
Sent: den 22 september 2018 00:53
To: [email protected]
Subject: Re: [OE-core] ✗ patchtest: failure for "[v1] busybox: CVE- 2017-15874..." and 2 more

Quoted 10 lines · Patchwork

== Series Details ==

Series: "[v1] busybox: CVE-2017-15874..." and 2 more
Revision: 1
URL : https://patchwork.openembedded.org/series/14184/
State : failure

== Summary ==

Quoted 7 lines

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch

Quoted 8 lines

[test_series_merge_on_head]

Quoted 3 lines

Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 957a2f95b8)

These patches do not apply to the master branch because they were intended for the sumo branch as a security fix. Is there a way to specify what particular branch this patch is targeting?

Add "[sumo]" to the subject.

Quoted 9 lines

Another reason is that package versions on master branch are newer.

Quoted 1 line

* Issue A patch file has been added, but does not have a

Signed-off-by tag [test_signed_off_by_presence]

Quoted 1 line

Suggested fix Sign off the added patch file (meta/recipes-

multimedia/libpng/files/CVE-2018-13785.patch)

Quoted 1 line

the original patch doesn't have a signed-off. What's the policy?

You should add a Signed-off-by with your own name to the patches.

Quoted 10 lines
Quoted 1 line

* Issue Added patch file is missing Upstream-Status in

the header [test_upstream_status_presence_format]

Quoted 1 line

Suggested fix Add Upstream-Status: <Valid status> to the header

of meta/recipes-core/busybox/busybox/CVE-2017-15874.patch

Quoted 2 lines

Standard format Upstream-Status: <Valid status>
Valid status Pending, Accepted, Backport, Denied,

Inappropriate [reason], Submitted [where]

Quoted 1 line

I'm fairly new to this. I believe I have this tag. Do I have a mistake?

The Upstream-Status should be in the patch, not the commit message.

Quoted 30 lines

commit b3761a1a9b05c97028034a44be27400114ccf526

Author: Sinan Kaya <[email protected]>
Date:   Fri Sep 21 04:20:44 2018 +0000

busybox: CVE-2017-15874

* CVE-2017-15874
busybox: Integer underflow in
archival/libarchive/decompress_unlzma.c

     (cherry picked from 9ac42c500586fa5f10a1f6d22c3f797df11b1f6b)

     Affects busybox <= 1.27.2

     Upstream-Status: Backport [
https://git.busybox.net/busybox/commit/?id=9ac42c500586fa5f10a1f6d22c3f
797df11b1f6b]
     CVE: CVE-2017-15874
     Ref: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2017-15874
     Signed-off-by: Sinan Kaya <[email protected]>
Quoted 3 lines

If you believe any of these test results are incorrect, please reply

to the

Quoted 1 line

mailing list ([email protected]) raising your

concerns.

Quoted 1 line

Otherwise we would appreciate you correcting the issues and

submitting a new

Quoted 1 line

version of the patchset if applicable. Please ensure you

Quoted 10 lines

add/increment the

Quoted 1 line

version number when sending the new version (i.e. [PATCH] -> [PATCH

v2] ->

Quoted 4 lines

[PATCH v3] -> ...).

---
Guidelines:

https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines

Quoted 2 lines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe

//Peter

author
#6 lore raw

Re: ✗ patchtest: failure for "[v1] busybox: CVE-2017-15874..." and 2 more

Quoted 3 lines · Peter Kjellerstedt
Quoted 1 line

the original patch doesn't have a signed-off. What's the policy?

You should add a Signed-off-by with your own name to the patches.

thanks, let me try this one more time.