Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 536012 (CVE-2015-1038) - <app-arch/p7zip-9.20.1-r5: directory traversal vulnerability (CVE-2015-1038)
Summary: <app-arch/p7zip-9.20.1-r5: directory traversal vulnerability (CVE-2015-1038)
Status: RESOLVED FIXED
Alias: CVE-2015-1038
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo Security
URL: https://bugzilla.redhat.com/show_bug....
Whiteboard: B4 [noglsa]
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-08 10:38 UTC by Agostino Sarubbo
Modified: 2015-11-09 22:04 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2015-01-08 10:38:45 UTC
From ${URL} :

It was reported [1] that p7zip suffers from a directory traversal flaw.  This could for the overwriting of arbitrary files through uncompressing a crafted archive, with the privileges of the user running 7z.  For example:

$ ln -s /tmp foo
$ 7z a test.7z foo
$ rm foo
$ mkdir foo
$ echo hello > foo/test
$ 7z a test.7z foo/test
$ rm -rf foo
$ 7z x test.7z

This will create 'foo' as a symlink to /tmp which will in turn contain the file 'test' with the privileges of the user unarchiving 'test.7z'.


[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774660


@maintainer(s): after the bump, in case we need to stabilize the package, please let us know if it is ready for the stabilization or not.
Comment 1 GLSAMaker/CVETool Bot gentoo-dev 2015-02-13 18:04:18 UTC
CVE-2015-1038 (http://nvd.nist.gov/nvd.cfm?cvename=CVE-2015-1038):
  p7zip 9.20.1 allows remote attackers to write to arbitrary files via a
  symlink attack in an archive.
Comment 2 Franz Trischberger 2015-03-29 13:37:42 UTC
I just had a look into the bump.
* DOCS was moved to DOC
* The three patches with 9.20.1- version are not needed anymore
The only issue I don't know how to proceed concerns 9.04-makefile.patch. The source for the diff changed. RAR_OBJS is not defined anymore. If I remove any Rar*.o I come up with this patch:
--- CPP/7zip/Bundles/Format7zFree/makefile.list 2015-03-29 15:32:08.556102622 +0200
+++ CPP/7zip/Bundles/Format7zFree/makefile.list.new     2015-03-29 15:31:57.774103350 +0200
@@ -828,7 +828,6 @@
  NtfsHandler.o \
  PeHandler.o \
  PpmdHandler.o \
- RarHandler.o \
  RpmHandler.o \
  SplitHandler.o \
  SquashfsHandler.o \
@@ -931,8 +930,6 @@
  MyAesReg.o \
  Pbkdf2HmacSha1.o \
  RandGen.o \
- Rar20Crypto.o \
- RarAes.o \
  Sha1.o \
  Sha1Reg.o \
  WzAes.o \


The ebuild diff:

--- p7zip-9.20.1-r5.ebuild      2015-03-29 14:56:14.152248012 +0200
+++ p7zip-9.38.1.ebuild 2015-03-29 15:35:28.256089146 +0200
@@ -30,11 +30,6 @@
 S=${WORKDIR}/${PN}_${PV}
 
 src_prepare() {
-       epatch \
-               "${FILESDIR}"/${P}-execstack.patch \
-               "${FILESDIR}"/${P}-QA.patch \
-               "${FILESDIR}"/${P}-long_rar_pwd.patch
-
        if ! use pch; then
                sed "s:PRE_COMPILED_HEADER=StdAfx.h.gch:PRE_COMPILED_HEADER=:g" -i makefile.* || die
        fi
@@ -54,7 +49,7 @@
        else
                sed -e '/Rar/d' -i makefile* || die
                rm -rf CPP/7zip/Compress/Rar || die
-               epatch "${FILESDIR}"/9.04-makefile.patch
+               epatch "${FILESDIR}"/${P}-makefile.patch
        fi
 
        sed -i \
@@ -153,7 +148,7 @@
        dodoc ChangeLog README TODO
 
        if use doc; then
-               dodoc DOCS/*.txt
-               dohtml -r DOCS/MANUAL/*
+               dodoc DOC/*.txt
+               dohtml -r DOC/MANUAL/*
        fi
 }




I took the testing -r5 as a base as it already supports multilib-build which just went stable. (not the ebuild but multilib...)
Comment 3 Alex Xu (Hello71) 2015-04-04 19:20:24 UTC
*** Bug 545202 has been marked as a duplicate of this bug. ***
Comment 4 Justin Lecher (RETIRED) gentoo-dev 2015-06-16 06:37:43 UTC
+*p7zip-9.20.1-r5 (16 Jun 2015)
+
+  16 Jun 2015; Justin Lecher <jlec@gentoo.org>
+  +files/p7zip-9.20.1-CVE-2015-1038.patch, +p7zip-9.20.1-r5.ebuild:
+  Import debian patch for CVE-2015-1038, bug #536012; latest version is still
+  vulnerable
+

@security, stable is fixed going to be fixed. Still waiting for the patch against latest ~arch version.
Comment 5 Justin Lecher (RETIRED) gentoo-dev 2015-06-16 06:38:50 UTC
@arches, please stable

p7zip-9.20.1-r5
Comment 6 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2015-06-16 08:48:48 UTC
amd64 stable
Comment 7 Agostino Sarubbo gentoo-dev 2015-06-17 07:32:34 UTC
x86 stable
Comment 8 Agostino Sarubbo gentoo-dev 2015-06-17 08:51:46 UTC
sparc stable
Comment 9 Jeroen Roovers (RETIRED) gentoo-dev 2015-06-18 04:51:03 UTC
Stable for HPPA.
Comment 10 Jeroen Roovers (RETIRED) gentoo-dev 2015-06-20 05:31:32 UTC
Stable for PPC64.
Comment 11 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2015-06-21 18:21:34 UTC
alpha stable
Comment 12 Justin Lecher (RETIRED) gentoo-dev 2015-06-22 07:13:41 UTC
+*p7zip-9.38.1-r2 (22 Jun 2015)
+
+  22 Jun 2015; Justin Lecher <jlec@gentoo.org>
+  +files/p7zip-9.38.1-CVE-2015-1038.patch, +p7zip-9.38.1-r2.ebuild,
+  -p7zip-9.38.1-r1.ebuild:
+  Fix CVE-2015-1038 in latest version, bug #536012
+

latest ~arch is now fixed as well. Only remaining stabilizations pending.
Comment 13 Agostino Sarubbo gentoo-dev 2015-06-24 07:54:25 UTC
ppc stable
Comment 14 Craxy Z 2015-06-25 04:31:55 UTC
I'm using gentoo-prefix on osx 10.10, with use flag "+pch +rar",
the patch p7zip-9.38.1-CVE-2015-1038.patch for 9.38.1-r2 cause a build failure:

---------------------------------------------
In file included from ../../../../CPP/7zip/UI/Common/Extract.cpp:9:
../../../../CPP/7zip/UI/Common/../../../Windows/FileDir.h:89:3: error: unknown type name 'ino_t'
  ino_t _ino;
  ^
---------------------------------------------

I fixed it by add the following line to the patch.

+#include <sys/stat.h> 

like this:
---------------------------------------------
 --- a/CPP/Windows/FileDir.h                                                     
 +++ b/CPP/Windows/FileDir.h                                                     
 @@ -4,6 +4,8 @@                                                                                                                                                                                             
  #define __WINDOWS_FILE_DIR_H                                                   
                                                                                
  #include "../Common/MyString.h"                                                
 +#include "../Common/MyVector.h"                                                
 +#include <sys/stat.h>                                                          
                                                                               
  #include "FileIO.h"                                                            
---------------------------------------------

It's not that proper, but works for me, just for you know
Comment 15 Justin Lecher (RETIRED) gentoo-dev 2015-06-25 07:17:13 UTC
(In reply to Craxy Z from comment #14)
> I'm using gentoo-prefix on osx 10.10, with use flag "+pch +rar",
> the patch p7zip-9.38.1-CVE-2015-1038.patch for 9.38.1-r2 cause a build
> failure:
> 
> ---------------------------------------------
> In file included from ../../../../CPP/7zip/UI/Common/Extract.cpp:9:
> ../../../../CPP/7zip/UI/Common/../../../Windows/FileDir.h:89:3: error:
> unknown type name 'ino_t'
>   ino_t _ino;
>   ^
> ---------------------------------------------
> 
> I fixed it by add the following line to the patch.
> 
> +#include <sys/stat.h> 
> 
> like this:
> ---------------------------------------------
>  --- a/CPP/Windows/FileDir.h                                                
> 
>  +++ b/CPP/Windows/FileDir.h                                                
> 
>  @@ -4,6 +4,8 @@                                                            
> 
>   #define __WINDOWS_FILE_DIR_H                                              
> 
>                                                                             
> 
>   #include "../Common/MyString.h"                                           
> 
>  +#include "../Common/MyVector.h"                                           
> 
>  +#include <sys/stat.h>                                                     
> 
>                                                                             
> 
>   #include "FileIO.h"                                                       
> 
> ---------------------------------------------
> 
> It's not that proper, but works for me, just for you know

Please file an additional bug for this. The prefix team needs to take care of it.
Comment 16 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2015-07-30 19:03:02 UTC
ia64 stable

Cleanup, please!

GLSA vote: no.
Comment 17 Justin Lecher (RETIRED) gentoo-dev 2015-07-30 19:10:40 UTC
+  30 Jul 2015; Justin Lecher <jlec@gentoo.org> -p7zip-9.20.1-r4.ebuild:
+  Drop vulnerable version, bug #536012
+

cleaned.
Comment 18 Stefan Behte (RETIRED) gentoo-dev Security 2015-11-09 22:04:34 UTC
Vote: NO.