diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2016-05-30 17:44:58 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2016-05-30 17:44:58 +0000 |
commit | f3f119d328f0cf56437edc38e278ecd7d8424ec3 (patch) | |
tree | 42dbb796980f3761c262472203c8de39a6c13719 /main/libarchive | |
parent | 6accf4596e89dcb7b86120055f9bdbf781b15bc0 (diff) | |
download | aports-f3f119d328f0cf56437edc38e278ecd7d8424ec3.tar.bz2 aports-f3f119d328f0cf56437edc38e278ecd7d8424ec3.tar.xz |
main/libarchive: security upgrade to 3.2.0 (CVE-2016-1541)
fixes #5561
Diffstat (limited to 'main/libarchive')
-rw-r--r-- | main/libarchive/APKBUILD | 18 | ||||
-rw-r--r-- | main/libarchive/CVE-2013-0211.patch | 32 | ||||
-rw-r--r-- | main/libarchive/CVE-2015-2304.patch | 143 |
3 files changed, 5 insertions, 188 deletions
diff --git a/main/libarchive/APKBUILD b/main/libarchive/APKBUILD index 75a6954e01..94403ce710 100644 --- a/main/libarchive/APKBUILD +++ b/main/libarchive/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=libarchive -pkgver=3.1.2 -pkgrel=2 +pkgver=3.2.0 +pkgrel=0 pkgdesc="library that can create and read several streaming archive formats" url="http://libarchive.googlecode.com/" arch="all" @@ -11,8 +11,6 @@ subpackages="$pkgname-dev $pkgname-doc $pkgname-tools" makedepends="zlib-dev bzip2-dev xz-dev acl-dev openssl-dev expat-dev" depends_dev="$makedepends" source="http://www.libarchive.org/downloads/libarchive-$pkgver.tar.gz - CVE-2013-0211.patch - CVE-2015-2304.patch " _builddir="$srcdir"/$pkgname-$pkgver @@ -47,12 +45,6 @@ tools() { mv "$pkgdir"/usr/bin "$subpkgdir"/usr/ } -md5sums="efad5a503f66329bb9d2f4308b5de98a libarchive-3.1.2.tar.gz -fc5f5158d414e3a7e9f085d8d1470014 CVE-2013-0211.patch -b27c60d9288780261410366994103278 CVE-2015-2304.patch" -sha256sums="eb87eacd8fe49e8d90c8fdc189813023ccc319c5e752b01fb6ad0cc7b2c53d5e libarchive-3.1.2.tar.gz -75f30c3867d3924461bb764ea2ca3c1b1e43240aeb5b0dd93a103fd7a7ca7fe9 CVE-2013-0211.patch -5a862586b4684d819add1df9d747bc47f9a4f2fecd069175bf00f6927c9633bf CVE-2015-2304.patch" -sha512sums="1f3c2a675031f93c7d42ae2ed06742b0b1e2236ff57d9117791d62fb8ae77d6cafffbcb5d45b5bd98daa908bd18c576cf82e01a9b1eba699705e23eff3688114 libarchive-3.1.2.tar.gz -c10470ab67dd94944489f72e4d6f39d98163f5d7a92bcd550aa323e9a1b96148588bd04ac7d8c6ff232dc388559fb3e67552bb5c83ac7626ad714517f5022fce CVE-2013-0211.patch -ae3161b36605c81622d4d4c44f33c31e596506dc60ffb43a91b0f7b831d15d48abdd64725cd770bca6795230f1505d301a74db63903c91507195ccdea0737b63 CVE-2015-2304.patch" +md5sums="596210b5a9c2ff74a0f7ca34838d655f libarchive-3.2.0.tar.gz" +sha256sums="7bce45fd71ff01dc20d19edd78322d4965583d81b8bed8e26cacb65d6f5baa87 libarchive-3.2.0.tar.gz" +sha512sums="e6a0ada8102c1b738115ccd0ffd8e64d2b9c2fa2eda813fddaa5b7e5021d6c063e868263292d9cae5f571482db332c9d49a42827b8ae71ffe14c182d6d214bfc libarchive-3.2.0.tar.gz" diff --git a/main/libarchive/CVE-2013-0211.patch b/main/libarchive/CVE-2013-0211.patch deleted file mode 100644 index c927a860e2..0000000000 --- a/main/libarchive/CVE-2013-0211.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 22531545514043e04633e1c015c7540b9de9dbe4 Mon Sep 17 00:00:00 2001 -From: Tim Kientzle <kientzle@acm.org> -Date: Fri, 22 Mar 2013 23:48:41 -0700 -Subject: [PATCH] Limit write requests to at most INT_MAX. This prevents a - certain common programming error (passing -1 to write) from leading to other - problems deeper in the library. - ---- - libarchive/archive_write.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/libarchive/archive_write.c b/libarchive/archive_write.c -index eede5e0..be85621 100644 ---- a/libarchive/archive_write.c -+++ b/libarchive/archive_write.c -@@ -673,8 +673,13 @@ struct archive_write_filter * - _archive_write_data(struct archive *_a, const void *buff, size_t s) - { - struct archive_write *a = (struct archive_write *)_a; -+ const size_t max_write = INT_MAX; -+ - archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, - ARCHIVE_STATE_DATA, "archive_write_data"); -+ /* In particular, this catches attempts to pass negative values. */ -+ if (s > max_write) -+ s = max_write; - archive_clear_error(&a->archive); - return ((a->format_write_data)(a, buff, s)); - } --- -1.8.1.6 - diff --git a/main/libarchive/CVE-2015-2304.patch b/main/libarchive/CVE-2015-2304.patch deleted file mode 100644 index cb7be5f18c..0000000000 --- a/main/libarchive/CVE-2015-2304.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 59357157706d47c365b2227739e17daba3607526 Mon Sep 17 00:00:00 2001 -From: Alessandro Ghedini <alessandro@ghedini.me> -Date: Sun, 1 Mar 2015 12:07:45 +0100 -Subject: [PATCH] Add ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS option - -This fixes a directory traversal in the cpio tool. ---- - cpio/bsdcpio.1 | 3 ++- - cpio/cpio.c | 2 ++ - libarchive/archive.h | 2 ++ - libarchive/archive_write_disk.3 | 3 +++ - libarchive/archive_write_disk_posix.c | 14 +++++++++++--- - libarchive/test/test_write_disk_secure.c | 23 +++++++++++++++++++++++ - 6 files changed, 43 insertions(+), 4 deletions(-) - -diff --git a/cpio/bsdcpio.1 b/cpio/bsdcpio.1 -index f966aa0..e52546e 100644 ---- a/cpio/bsdcpio.1 -+++ b/cpio/bsdcpio.1 -@@ -156,7 +156,8 @@ See above for description. - .It Fl Fl insecure - (i and p mode only) - Disable security checks during extraction or copying. --This allows extraction via symbolic links and path names containing -+This allows extraction via symbolic links, absolute paths, -+and path names containing - .Sq .. - in the name. - .It Fl J , Fl Fl xz -diff --git a/cpio/cpio.c b/cpio/cpio.c -index 0acde11..b267e9b 100644 ---- a/cpio/cpio.c -+++ b/cpio/cpio.c -@@ -171,6 +171,7 @@ main(int argc, char *argv[]) - cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER; - cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS; - cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT; -+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS; - cpio->extract_flags |= ARCHIVE_EXTRACT_PERM; - cpio->extract_flags |= ARCHIVE_EXTRACT_FFLAGS; - cpio->extract_flags |= ARCHIVE_EXTRACT_ACL; -@@ -256,6 +257,7 @@ main(int argc, char *argv[]) - case OPTION_INSECURE: - cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_SYMLINKS; - cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT; -+ cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS; - break; - case 'L': /* GNU cpio */ - cpio->option_follow_links = 1; -diff --git a/libarchive/archive.h b/libarchive/archive.h -index 1f0fc38..ef635ac 100644 ---- a/libarchive/archive.h -+++ b/libarchive/archive.h -@@ -649,6 +649,8 @@ __LA_DECL int archive_read_set_passphrase_callback(struct archive *, - /* Default: Do not use HFS+ compression if it was not compressed. */ - /* This has no effect except on Mac OS v10.6 or later. */ - #define ARCHIVE_EXTRACT_HFS_COMPRESSION_FORCED (0x8000) -+/* Default: Do not reject entries with absolute paths */ -+#define ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS (0x10000) - - __LA_DECL int archive_read_extract(struct archive *, struct archive_entry *, - int flags); -diff --git a/libarchive/archive_write_disk.3 b/libarchive/archive_write_disk.3 -index fa925cc..a2e7afa 100644 ---- a/libarchive/archive_write_disk.3 -+++ b/libarchive/archive_write_disk.3 -@@ -177,6 +177,9 @@ The default is to not refuse such paths. - Note that paths ending in - .Pa .. - always cause an error, regardless of this flag. -+.It Cm ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS -+Refuse to extract an absolute path. -+The default is to not refuse such paths. - .It Cm ARCHIVE_EXTRACT_SPARSE - Scan data for blocks of NUL bytes and try to recreate them with holes. - This results in sparse files, independent of whether the archive format -diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c -index ab3bdac..c1290eb 100644 ---- a/libarchive/archive_write_disk_posix.c -+++ b/libarchive/archive_write_disk_posix.c -@@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a) - /* - * Canonicalize the pathname. In particular, this strips duplicate - * '/' characters, '.' elements, and trailing '/'. It also raises an -- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is -- * set) any '..' in the path. -+ * error for an empty path, a trailing '..', (if _SECURE_NODOTDOT is -+ * set) any '..' in the path or (if ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS -+ * is set) if the path is absolute. - */ - static int - cleanup_pathname(struct archive_write_disk *a) -@@ -2529,8 +2530,15 @@ cleanup_pathname(struct archive_write_disk *a) - cleanup_pathname_win(a); - #endif - /* Skip leading '/'. */ -- if (*src == '/') -+ if (*src == '/') { -+ if (a->flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) { -+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, -+ "Path is absolute"); -+ return (ARCHIVE_FAILED); -+ } -+ - separator = *src++; -+ } - - /* Scan the pathname one element at a time. */ - for (;;) { -diff --git a/libarchive/test/test_write_disk_secure.c b/libarchive/test/test_write_disk_secure.c -index 31c5bfd..2c94206 100644 ---- a/libarchive/test/test_write_disk_secure.c -+++ b/libarchive/test/test_write_disk_secure.c -@@ -178,6 +178,29 @@ DEFINE_TEST(test_write_disk_secure) - assert(S_ISDIR(st.st_mode)); - archive_entry_free(ae); - -+ /* -+ * Without security checks, we should be able to -+ * extract an absolute path. -+ */ -+ assert((ae = archive_entry_new()) != NULL); -+ archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"); -+ archive_entry_set_mode(ae, S_IFREG | 0777); -+ assert(0 == archive_write_header(a, ae)); -+ assert(0 == archive_write_finish_entry(a)); -+ assertFileExists("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"); -+ assert(0 == unlink("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp")); -+ -+ /* But with security checks enabled, this should fail. */ -+ assert(archive_entry_clear(ae) != NULL); -+ archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"); -+ archive_entry_set_mode(ae, S_IFREG | 0777); -+ archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS); -+ failure("Extracting an absolute path should fail here."); -+ assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae)); -+ archive_entry_free(ae); -+ assert(0 == archive_write_finish_entry(a)); -+ assertFileNotExists("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"); -+ - assertEqualInt(ARCHIVE_OK, archive_write_free(a)); - - /* Test the entries on disk. */ |