Bug 1260716 (CVE-2014-9767)

Summary: CVE-2014-9767 php: ZipArchive::extractTo allows for directory traversal when creating directories
Product: [Other] Security Response Reporter: Adam Mariš <amaris>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: bleanhar, ccoleman, dmcphers, fedora, jdetiber, jialiu, jkeck, jokerman, jorton, kseifried, lmeyer, mmaslano, mmccomas, rcollet, webstack-team
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: php 5.4.45, php 5.5.29, php 5.6.13 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-12 21:42:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1260758, 1260759    
Bug Blocks: 1260756    

Description Adam Mariš 2015-09-07 13:53:31 UTC
Inside php_zip.c there's a function called php_zip_make_relative_path which is used to sanitize the file path when extracting a file/directory from a ZIP. When extracting a file, the sanitized pathname is used, so files are only created inside of the directory where they're being extracted. However, for directories, the unsanitized/user-provided "file" value is used instead of the sanitized "path_cleaned" value. As a result, a directory can be created outside of the directory where a ZIP file is being extracted.

Upstream report:

https://bugs.php.net/bug.php?id=70350

Upstream patch:

http://git.php.net/?p=php-src.git;a=commit;h=f9c2bf73adb2ede0a486b0db466c264f2b27e0bb

Comment 1 Adam Mariš 2015-09-07 16:12:14 UTC
Created php-pecl-zip tracking bugs for this issue:

Affects: fedora-all [bug 1260758]
Affects: epel-5 [bug 1260759]

Comment 2 Fedora Update System 2015-09-19 18:55:44 UTC
php-pecl-zip-1.13.1-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 3 Fedora Update System 2015-09-19 21:51:24 UTC
php-pecl-zip-1.12.5-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 4 Fedora Update System 2015-09-19 23:19:53 UTC
php-pecl-zip-1.12.5-1.fc21 has been pushed to the Fedora 21 stable repository. If problems still persist, please make note of it in this bug report.

Comment 6 Andrej Nemec 2016-03-17 09:00:54 UTC
CVE assignment:

http://seclists.org/oss-sec/2016/q1/671

Comment 7 errata-xmlrpc 2016-11-15 11:47:02 UTC
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 6
  Red Hat Software Collections for Red Hat Enterprise Linux 6.7 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7
  Red Hat Software Collections for Red Hat Enterprise Linux 7.2 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7.3 EUS

Via RHSA-2016:2750 https://rhn.redhat.com/errata/RHSA-2016-2750.html