Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1207682 - (CVE-2015-2348) CVE-2015-2348 php: move_uploaded_file() NUL byte injection in file name
CVE-2015-2348 php: move_uploaded_file() NUL byte injection in file name
Status: CLOSED ERRATA
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=20150302,repor...
: Security
Depends On: 1204765 1204766 1207702 1209880 1209884 1209887
Blocks: 1207679 1210213
  Show dependency treegraph
 
Reported: 2015-03-31 09:19 EDT by Vasyl Kaigorodov
Modified: 2015-07-10 04:02 EDT (History)
16 users (show)

See Also:
Fixed In Version: PHP 5.4.39, PHP 5.5.23, PHP 5.6.7
Doc Type: Bug Fix
Doc Text:
It was found that PHP move_uploaded_file() function did not properly handle file names with a NULL character. A remote attacker could possibly use this flaw to make a PHP script access unexpected files and bypass intended file system access restrictions.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-07-09 17:46:28 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-2015:1053 normal SHIPPED_LIVE Moderate: php55 security and bug fix update 2015-06-04 08:06:06 EDT
Red Hat Product Errata RHSA-2015:1066 normal SHIPPED_LIVE Important: php54 security and bug fix update 2015-06-05 11:42:20 EDT
Red Hat Product Errata RHSA-2015:1135 normal SHIPPED_LIVE Important: php security and bug fix update 2015-06-23 08:11:40 EDT

  None (edit)
Description Vasyl Kaigorodov 2015-03-31 09:19:30 EDT
Common Vulnerabilities and Exposures assigned an identifier CVE-2015-2348 to
the following vulnerability:

Name: CVE-2015-2348
URL: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-2348
Assigned: 20150319
Reference: https://bugs.php.net/bug.php?id=69207

The move_uploaded_file implementation in
ext/standard/basic_functions.c in PHP before 5.4.39, 5.5.x before
5.5.23, and 5.6.x before 5.6.7 truncates a pathname upon encountering
a \x00 character, which allows remote attackers to bypass intended
extension restrictions and create files with unexpected names via a
crafted second argument.  NOTE: this vulnerability exists because of an
incomplete fix for CVE-2006-7243.
Comment 1 Vasyl Kaigorodov 2015-03-31 09:48:15 EDT
Created php tracking bugs for this issue:

Affects: fedora-all [bug 1207702]
Comment 8 Remi Collet 2015-04-10 03:55:33 EDT
PHP 5.3.3 in RHEL is not affected,
as already fixed by php-5.3.3-CVE-2006-7243.patch

@@ -5811,6 +5834,14 @@ PHP_FUNCTION(move_uploaded_file)
 		RETURN_FALSE;
 	}
 
+	if (strlen(path) != path_len) {
+		RETURN_FALSE;
+	}
+
+	if (strlen(new_path) != new_path_len) {
+		RETURN_FALSE;
+	}
+
 	VCWD_UNLINK(new_path);
 	if (VCWD_RENAME(path, new_path) == 0) {
 		successful = 1;

So only affects PHP 5.4+

Notice, the check for 'path' is not need as already checked by zend_hash_exists.
So upstream patch use "p" only for 'new_path'
Comment 9 Tomas Hoger 2015-04-10 09:02:56 EDT
Ok, thank you for pointing this out.  So rather than this being an incomplete CVE-2006-7243 fix issue, it's more of a 5.4+ regression of part of the CVE-2006-7243 fix.  Similar to CVE-2014-5120, and likely with similar cause to what's described in bug 1132793 comment 7 and bug 1132793 comment 8.

The fix noted in comment 8 above is used in php and php53 packages in Red Hat Enterprise Linux 5 and 6, hence those are not affected by this issue.  The php packages in Red Hat Enterprise Linux 7 and Red Hat Software Collections 1 are based on upstream 5.4 or 5.5 and are therefore affected.

Statement:

This issue does not affect the current php and php53 packages in Red Hat Enterprise Linux 5 and 6, as it was previously corrected as part of the fix for CVE-2006-7243.
Comment 11 errata-xmlrpc 2015-06-04 04:04:23 EDT
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 7
  Red Hat Software Collections for Red Hat Enterprise Linux 6
  Red Hat Software Collections for Red Hat Enterprise Linux 6.6 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 6.5 EUS

Via RHSA-2015:1066 https://rhn.redhat.com/errata/RHSA-2015-1066.html
Comment 12 errata-xmlrpc 2015-06-04 04:07:45 EDT
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 7
  Red Hat Software Collections for Red Hat Enterprise Linux 6
  Red Hat Software Collections for Red Hat Enterprise Linux 6.6 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 6.5 EUS

Via RHSA-2015:1053 https://rhn.redhat.com/errata/RHSA-2015-1053.html
Comment 13 errata-xmlrpc 2015-06-23 04:12:43 EDT
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2015:1135 https://rhn.redhat.com/errata/RHSA-2015-1135.html

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