unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: tar: Fix CVE-2016-6321.
@ 2016-12-31  8:03 Alex Vong
  2016-12-31 14:57 ` Alex Vong
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Vong @ 2016-12-31  8:03 UTC (permalink / raw)
  To: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 233 bytes --]

Hi Guix,

This patch fixes CVE-2016-6321 for GNU Tar. The patch is basically
directly copied from upstream with the modification to the NEWS file
removed since it hunks out to a reject file. The message below is for
your reference.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-tar-Fix-CVE-2016-6321.patch --]
[-- Type: text/x-diff, Size: 3806 bytes --]

From 934e7d752bdd04521c8d0bc2c6cde4a66bf074b4 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@gmail.com>
Date: Sat, 31 Dec 2016 00:05:49 +0800
Subject: [PATCH] gnu: tar: Fix CVE-2016-6321.

* gnu/packages/patches/tar-CVE-2016-6321.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/base.scm (tar)[source]: Add it.
---
 gnu/local.mk                                 |  1 +
 gnu/packages/base.scm                        |  3 +-
 gnu/packages/patches/tar-CVE-2016-6321.patch | 51 ++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/tar-CVE-2016-6321.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index b7c182fbf..5a7cedbe2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -862,6 +862,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/t1lib-CVE-2010-2642.patch		\
   %D%/packages/patches/t1lib-CVE-2011-0764.patch		\
   %D%/packages/patches/t1lib-CVE-2011-1552+CVE-2011-1553+CVE-2011-1554.patch		\
+  %D%/packages/patches/tar-CVE-2016-6321.patch \
   %D%/packages/patches/tar-skip-unreliable-tests.patch		\
   %D%/packages/patches/tcl-mkindex-deterministic.patch		\
   %D%/packages/patches/tclxml-3.2-install.patch			\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 50c306009..ce6e3782c 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -162,7 +162,8 @@ implementation offers several extensions over the standard utility.")
             (sha256
              (base32
               "097hx7sbzp8qirl4m930lw84kn0wmxhmq7v1qpra3mrg0b8cyba0"))
-            (patches (search-patches "tar-skip-unreliable-tests.patch"))))
+            (patches (search-patches "tar-CVE-2016-6321.patch"
+                                     "tar-skip-unreliable-tests.patch"))))
    (build-system gnu-build-system)
    ;; Note: test suite requires ~1GiB of disk space.
    (arguments
diff --git a/gnu/packages/patches/tar-CVE-2016-6321.patch b/gnu/packages/patches/tar-CVE-2016-6321.patch
new file mode 100644
index 000000000..9e6ee653d
--- /dev/null
+++ b/gnu/packages/patches/tar-CVE-2016-6321.patch
@@ -0,0 +1,51 @@
+Fix CVE-2016-6321:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-6321
+https://security-tracker.debian.org/tracker/CVE-2016-6321
+
+Patches copied from upstream source repository
+(with modification to NEWS removed since it hunks out to a reject file):
+
+http://git.savannah.gnu.org/cgit/tar.git/commit/?id=7340f67b9860ea0531c1450e5aa261c50f67165d
+
+From 7340f67b9860ea0531c1450e5aa261c50f67165d Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@Penguin.CS.UCLA.EDU>
+Date: Sat, 29 Oct 2016 21:04:40 -0700
+Subject: [PATCH] When extracting, skip ".." members
+
+* NEWS: Document this.
+* src/extract.c (extract_archive): Skip members whose names
+contain "..".
+---
+ NEWS          | 8 +++++++-
+ src/extract.c | 8 ++++++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/extract.c b/src/extract.c
+index f982433..7904148 100644
+--- a/src/extract.c
++++ b/src/extract.c
+@@ -1629,12 +1629,20 @@ extract_archive (void)
+ {
+   char typeflag;
+   tar_extractor_t fun;
++  bool skip_dotdot_name;
+ 
+   fatal_exit_hook = extract_finish;
+ 
+   set_next_block_after (current_header);
+ 
++  skip_dotdot_name = (!absolute_names_option
++		      && contains_dot_dot (current_stat_info.orig_file_name));
++  if (skip_dotdot_name)
++    ERROR ((0, 0, _("%s: Member name contains '..'"),
++	    quotearg_colon (current_stat_info.orig_file_name)));
++
+   if (!current_stat_info.file_name[0]
++      || skip_dotdot_name
+       || (interactive_option
+ 	  && !confirm ("extract", current_stat_info.file_name)))
+     {
+-- 
+2.11.0
+
-- 
2.11.0


[-- Attachment #1.3: Type: text/plain, Size: 32 bytes --]


Happy New Year!

Cheers,
Alex


[-- Attachment #1.4: Type: message/rfc822, Size: 6834 bytes --]

From: Salvatore Bonaccorso <carnil@debian.org>
To: debian-security-announce@lists.debian.org
Subject: [SECURITY] [DSA 3702-1] tar security update
Date: Tue, 01 Nov 2016 19:15:47 +0000
Message-ID: <E1c1eXD-00069r-Co@master.debian.org>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

- -------------------------------------------------------------------------
Debian Security Advisory DSA-3702-1                   security@debian.org
https://www.debian.org/security/                     Salvatore Bonaccorso
November 01, 2016                     https://www.debian.org/security/faq
- -------------------------------------------------------------------------

Package        : tar
CVE ID         : CVE-2016-6321
Debian Bug     : 842339

Harry Sintonen discovered that GNU tar does not properly handle member
names containing '..', thus allowing an attacker to bypass the path
names specified on the command line and replace files and directories in
the target directory.

For the stable distribution (jessie), this problem has been fixed in
version 1.27.1-2+deb8u1.

For the unstable distribution (sid), this problem has been fixed in
version 1.29b-1.1.

We recommend that you upgrade your tar packages.

Further information about Debian Security Advisories, how to apply
these updates to your system and frequently asked questions can be
found at: https://www.debian.org/security/

Mailing list: debian-security-announce@lists.debian.org
-----BEGIN PGP SIGNATURE-----

iQJ8BAEBCgBmBQJYGOmnXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ0NjQ0NDA5ODA4QzE3MUUwNTUzMURERUUw
NTRDQjhGMzEzNDNDRjQ0AAoJEAVMuPMTQ89ETe4P+wQ40R0+scWjRMusH3nqztuF
gO8efN5Q+NQwQVEHv9XNxh4WOTuFrBTKicVPud4jziNx810kfe6pxXoeEdL4FvBp
jb3mrETbzMMZfj2IC9OOc04bV473hw/GpTfA1BNPdnAB0eOTsYlpT2tGN/8l2bA9
MtAkVWGEq/jUITbB0hgKwwX5YOo3qq59NneQzkQM3gwfbDqOzFL0v78oRoQYKB4V
/kXH5TZdNXu1kBBzQyl6C7tPYplakRSdpFbH8B+03c5dIUZj+2rjBeLqUt3BwkLQ
Ym0sdWai6Hg2WPrASQ9FA7kn675RURN963cNyJ9zWZssQ+v2fxOpp+9gmYhIBSyI
XUkE/FkvmygCFJkruQL1L9s3nbsIrRqqJehchFNZpse2ctyuQySANXnk/j4B3Pjz
X+DmCdXS9PbxdRsr9G4JY86gcq3ZHPEylYKqmjbLIzwh2UdLvmTt72IMCPxhPkyL
9QqQ2+ROy2BeeZsqc3fS9hwIrqsn/aakB60ODTAwD47JwxKkbcaoPsLQMays/yF0
YwcobceqQh10AufdBMU22OeKZYbR0bh5dScBd6crkcPxe2/5AQnw3rF8ti2jbgJH
99Ob5Ha8vVt6ZIxdsurVzVapPhAuXgVFnbv+tT6Fo23FwV4lDqZsCt+87FKDeapO
irBr67NKsaw6ZgW2b6s8
=EAIZ
-----END PGP SIGNATURE-----


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: tar: Fix CVE-2016-6321.
  2016-12-31  8:03 [PATCH] gnu: tar: Fix CVE-2016-6321 Alex Vong
@ 2016-12-31 14:57 ` Alex Vong
  2017-01-01 18:58   ` Kei Kebreau
  2017-01-02  1:24   ` Leo Famulari
  0 siblings, 2 replies; 4+ messages in thread
From: Alex Vong @ 2016-12-31 14:57 UTC (permalink / raw)
  To: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 120 bytes --]

This is an updated version of the patch. There is only a minor stylish
change, spaces in local.mk are changed to tabs.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-tar-Fix-CVE-2016-6321.patch --]
[-- Type: text/x-diff, Size: 3808 bytes --]

From 0cf96ac1167906565c560a12ab730d2192779315 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@gmail.com>
Date: Sat, 31 Dec 2016 00:05:49 +0800
Subject: [PATCH] gnu: tar: Fix CVE-2016-6321.

* gnu/packages/patches/tar-CVE-2016-6321.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/base.scm (tar)[source]: Add it.
---
 gnu/local.mk                                 |  1 +
 gnu/packages/base.scm                        |  3 +-
 gnu/packages/patches/tar-CVE-2016-6321.patch | 51 ++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/tar-CVE-2016-6321.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 69633131e..9137a466e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -862,6 +862,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/t1lib-CVE-2010-2642.patch		\
   %D%/packages/patches/t1lib-CVE-2011-0764.patch		\
   %D%/packages/patches/t1lib-CVE-2011-1552+CVE-2011-1553+CVE-2011-1554.patch		\
+  %D%/packages/patches/tar-CVE-2016-6321.patch			\
   %D%/packages/patches/tar-skip-unreliable-tests.patch		\
   %D%/packages/patches/tcl-mkindex-deterministic.patch		\
   %D%/packages/patches/tclxml-3.2-install.patch			\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 50c306009..ce6e3782c 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -162,7 +162,8 @@ implementation offers several extensions over the standard utility.")
             (sha256
              (base32
               "097hx7sbzp8qirl4m930lw84kn0wmxhmq7v1qpra3mrg0b8cyba0"))
-            (patches (search-patches "tar-skip-unreliable-tests.patch"))))
+            (patches (search-patches "tar-CVE-2016-6321.patch"
+                                     "tar-skip-unreliable-tests.patch"))))
    (build-system gnu-build-system)
    ;; Note: test suite requires ~1GiB of disk space.
    (arguments
diff --git a/gnu/packages/patches/tar-CVE-2016-6321.patch b/gnu/packages/patches/tar-CVE-2016-6321.patch
new file mode 100644
index 000000000..9e6ee653d
--- /dev/null
+++ b/gnu/packages/patches/tar-CVE-2016-6321.patch
@@ -0,0 +1,51 @@
+Fix CVE-2016-6321:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-6321
+https://security-tracker.debian.org/tracker/CVE-2016-6321
+
+Patches copied from upstream source repository
+(with modification to NEWS removed since it hunks out to a reject file):
+
+http://git.savannah.gnu.org/cgit/tar.git/commit/?id=7340f67b9860ea0531c1450e5aa261c50f67165d
+
+From 7340f67b9860ea0531c1450e5aa261c50f67165d Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@Penguin.CS.UCLA.EDU>
+Date: Sat, 29 Oct 2016 21:04:40 -0700
+Subject: [PATCH] When extracting, skip ".." members
+
+* NEWS: Document this.
+* src/extract.c (extract_archive): Skip members whose names
+contain "..".
+---
+ NEWS          | 8 +++++++-
+ src/extract.c | 8 ++++++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/src/extract.c b/src/extract.c
+index f982433..7904148 100644
+--- a/src/extract.c
++++ b/src/extract.c
+@@ -1629,12 +1629,20 @@ extract_archive (void)
+ {
+   char typeflag;
+   tar_extractor_t fun;
++  bool skip_dotdot_name;
+ 
+   fatal_exit_hook = extract_finish;
+ 
+   set_next_block_after (current_header);
+ 
++  skip_dotdot_name = (!absolute_names_option
++		      && contains_dot_dot (current_stat_info.orig_file_name));
++  if (skip_dotdot_name)
++    ERROR ((0, 0, _("%s: Member name contains '..'"),
++	    quotearg_colon (current_stat_info.orig_file_name)));
++
+   if (!current_stat_info.file_name[0]
++      || skip_dotdot_name
+       || (interactive_option
+ 	  && !confirm ("extract", current_stat_info.file_name)))
+     {
+-- 
+2.11.0
+
-- 
2.11.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: tar: Fix CVE-2016-6321.
  2016-12-31 14:57 ` Alex Vong
@ 2017-01-01 18:58   ` Kei Kebreau
  2017-01-02  1:24   ` Leo Famulari
  1 sibling, 0 replies; 4+ messages in thread
From: Kei Kebreau @ 2017-01-01 18:58 UTC (permalink / raw)
  To: Alex Vong; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 4261 bytes --]

Alex Vong <alexvong1995@gmail.com> writes:

> This is an updated version of the patch. There is only a minor stylish
> change, spaces in local.mk are changed to tabs.
>
> From 0cf96ac1167906565c560a12ab730d2192779315 Mon Sep 17 00:00:00 2001
> From: Alex Vong <alexvong1995@gmail.com>
> Date: Sat, 31 Dec 2016 00:05:49 +0800
> Subject: [PATCH] gnu: tar: Fix CVE-2016-6321.
>
> * gnu/packages/patches/tar-CVE-2016-6321.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.
> * gnu/packages/base.scm (tar)[source]: Add it.
> ---
>  gnu/local.mk                                 |  1 +
>  gnu/packages/base.scm                        |  3 +-
>  gnu/packages/patches/tar-CVE-2016-6321.patch | 51 ++++++++++++++++++++++++++++
>  3 files changed, 54 insertions(+), 1 deletion(-)
>  create mode 100644 gnu/packages/patches/tar-CVE-2016-6321.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 69633131e..9137a466e 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -862,6 +862,7 @@ dist_patch_DATA =						\
>    %D%/packages/patches/t1lib-CVE-2010-2642.patch		\
>    %D%/packages/patches/t1lib-CVE-2011-0764.patch		\
>    %D%/packages/patches/t1lib-CVE-2011-1552+CVE-2011-1553+CVE-2011-1554.patch		\
> +  %D%/packages/patches/tar-CVE-2016-6321.patch			\
>    %D%/packages/patches/tar-skip-unreliable-tests.patch		\
>    %D%/packages/patches/tcl-mkindex-deterministic.patch		\
>    %D%/packages/patches/tclxml-3.2-install.patch			\
> diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
> index 50c306009..ce6e3782c 100644
> --- a/gnu/packages/base.scm
> +++ b/gnu/packages/base.scm
> @@ -162,7 +162,8 @@ implementation offers several extensions over the standard utility.")
>              (sha256
>               (base32
>                "097hx7sbzp8qirl4m930lw84kn0wmxhmq7v1qpra3mrg0b8cyba0"))
> -            (patches (search-patches "tar-skip-unreliable-tests.patch"))))
> +            (patches (search-patches "tar-CVE-2016-6321.patch"
> +                                     "tar-skip-unreliable-tests.patch"))))
>     (build-system gnu-build-system)
>     ;; Note: test suite requires ~1GiB of disk space.
>     (arguments
> diff --git a/gnu/packages/patches/tar-CVE-2016-6321.patch b/gnu/packages/patches/tar-CVE-2016-6321.patch
> new file mode 100644
> index 000000000..9e6ee653d
> --- /dev/null
> +++ b/gnu/packages/patches/tar-CVE-2016-6321.patch
> @@ -0,0 +1,51 @@
> +Fix CVE-2016-6321:
> +
> +https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-6321
> +https://security-tracker.debian.org/tracker/CVE-2016-6321
> +
> +Patches copied from upstream source repository
> +(with modification to NEWS removed since it hunks out to a reject file):
> +
> +http://git.savannah.gnu.org/cgit/tar.git/commit/?id=7340f67b9860ea0531c1450e5aa261c50f67165d
> +
> +From 7340f67b9860ea0531c1450e5aa261c50f67165d Mon Sep 17 00:00:00 2001
> +From: Paul Eggert <eggert@Penguin.CS.UCLA.EDU>
> +Date: Sat, 29 Oct 2016 21:04:40 -0700
> +Subject: [PATCH] When extracting, skip ".." members
> +
> +* NEWS: Document this.
> +* src/extract.c (extract_archive): Skip members whose names
> +contain "..".
> +---
> + NEWS          | 8 +++++++-
> + src/extract.c | 8 ++++++++
> + 2 files changed, 15 insertions(+), 1 deletion(-)
> +
> +diff --git a/src/extract.c b/src/extract.c
> +index f982433..7904148 100644
> +--- a/src/extract.c
> ++++ b/src/extract.c
> +@@ -1629,12 +1629,20 @@ extract_archive (void)
> + {
> +   char typeflag;
> +   tar_extractor_t fun;
> ++  bool skip_dotdot_name;
> + 
> +   fatal_exit_hook = extract_finish;
> + 
> +   set_next_block_after (current_header);
> + 
> ++  skip_dotdot_name = (!absolute_names_option
> ++		      && contains_dot_dot (current_stat_info.orig_file_name));
> ++  if (skip_dotdot_name)
> ++    ERROR ((0, 0, _("%s: Member name contains '..'"),
> ++	    quotearg_colon (current_stat_info.orig_file_name)));
> ++
> +   if (!current_stat_info.file_name[0]
> ++      || skip_dotdot_name
> +       || (interactive_option
> + 	  && !confirm ("extract", current_stat_info.file_name)))
> +     {
> +-- 
> +2.11.0
> +

LGTM. If I am correct, this should go in core-updates, as the update
would cause 1266 rebuilds.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: tar: Fix CVE-2016-6321.
  2016-12-31 14:57 ` Alex Vong
  2017-01-01 18:58   ` Kei Kebreau
@ 2017-01-02  1:24   ` Leo Famulari
  1 sibling, 0 replies; 4+ messages in thread
From: Leo Famulari @ 2017-01-02  1:24 UTC (permalink / raw)
  To: Alex Vong; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 646 bytes --]

On Sat, Dec 31, 2016 at 10:57:50PM +0800, Alex Vong wrote:
> This is an updated version of the patch. There is only a minor stylish
> change, spaces in local.mk are changed to tabs.
> 

> From 0cf96ac1167906565c560a12ab730d2192779315 Mon Sep 17 00:00:00 2001
> From: Alex Vong <alexvong1995@gmail.com>
> Date: Sat, 31 Dec 2016 00:05:49 +0800
> Subject: [PATCH] gnu: tar: Fix CVE-2016-6321.
> 
> * gnu/packages/patches/tar-CVE-2016-6321.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.
> * gnu/packages/base.scm (tar)[source]: Add it.

Thanks! Pushed to core-updates with some minor edits to the patch file
commentary.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-02  1:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-31  8:03 [PATCH] gnu: tar: Fix CVE-2016-6321 Alex Vong
2016-12-31 14:57 ` Alex Vong
2017-01-01 18:58   ` Kei Kebreau
2017-01-02  1:24   ` Leo Famulari

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).