Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 1323106 - (CVE-2016-4072) CVE-2016-4072 php: Invalid memory write in phar on filename containing \0 inside name
CVE-2016-4072 php: Invalid memory write in phar on filename containing \0 ins...
Status: CLOSED WONTFIX
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
medium Severity medium
: ---
: ---
Assigned To: Red Hat Product Security
impact=moderate,public=20160319,repor...
: Security
Depends On: 1323111
Blocks: 1323121
  Show dependency treegraph
 
Reported: 2016-04-01 06:03 EDT by Adam Mariš
Modified: 2017-11-09 04:09 EST (History)
17 users (show)

See Also:
Fixed In Version: php 5.5.34, php 5.6.20, php 7.0.5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-06-23 07:03:42 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2750 normal SHIPPED_LIVE Moderate: rh-php56 security, bug fix, and enhancement update 2016-11-15 11:40:02 EST

  None (edit)
Description Adam Mariš 2016-04-01 06:03:15 EDT
An invalid write vulnerability causing segmentation fault in phar on filename with \0 inside its name was found.

Vulnerable code (phar_analyze_path):

				if (!(realpath = expand_filepath(filename, NULL))) {
					efree(filename);
					return FAILURE;
				}
#ifdef PHP_WIN32
				phar_unixify_path_separators(realpath, strlen(realpath));
#endif
				slash = strstr(realpath, filename);
				if (slash) {
					slash += ((ext - fname) + ext_len);
					*slash = '\0';
				}

If fname and thus filename contain \0's, realpath would not contain those parts and thus slash would point past the end of the realpath buffer.

To exploit this, application has to allow attacker to create phar files with arbitrary filenames.

Upstream bug:

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

Upstream patch:

https://gist.github.com/smalyshev/80b5c2909832872f2ba2
https://git.php.net/?p=php-src.git;a=commit;h=1e9b175204e3286d64dfd6c9f09151c31b5e099a
Comment 1 Adam Mariš 2016-04-01 06:10:45 EDT
Created php tracking bugs for this issue:

Affects: fedora-all [bug 1323111]
Comment 2 Fedora Update System 2016-04-09 10:21:11 EDT
php-5.6.20-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 3 Fedora Update System 2016-04-09 10:22:40 EDT
php-5.6.20-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 5 errata-xmlrpc 2016-11-15 06:50:36 EST
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

Note You need to log in before you can comment on or make changes to this bug.