Bug 1185904 (CVE-2015-1352)

Summary: CVE-2015-1352 php: NULL pointer dereference in pgsql extension
Product: [Other] Security Response Reporter: Vasyl Kaigorodov <vkaigoro>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: bgollahe, bleanhar, bressers, ccoleman, dkutalek, dmcphers, fedora, jdetiber, jialiu, jkeck, jokerman, jorton, kanderso, kseifried, lmeyer, mmaslano, mmccomas, rcollet, webstack-team
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: php 5.4.40, php 5.5.24, php 5.6.8 Doc Type: Bug Fix
Doc Text:
A NULL pointer dereference flaw was found in PHP's pgsql extension. A specially crafted table name passed to a function such as pg_insert() or pg_select() could cause a PHP application to crash.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-04 08:13:35 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: 1185897, 1209880, 1209884, 1209887, 1228056, 1228057, 1228058, 1228059, 1228060, 1228061    
Bug Blocks: 1185412    

Description Vasyl Kaigorodov 2015-01-26 15:25:05 UTC
It was reported [1] that a null pointer dereference is possible in 'pgsql' PHP extension, when running pg_insert() with a NULL table-name.
Upstream commit with the fix:
http://git.php.net/?p=php-src.git;a=commit;h=124fb22a13fafa3648e4e15b4f207c7096d8155e

[1]: https://bugs.php.net/bug.php?id=68741

Comment 1 Vasyl Kaigorodov 2015-01-26 15:27:03 UTC
Created php tracking bugs for this issue:

Affects: fedora-all [bug 1185897]

Comment 2 Remi Collet 2015-04-02 14:07:06 UTC
Notice about this issue: If the (remote) user can change the SQL request to send a NULL table-name, the system have much more serious issues that this segfault.

Comment 3 Tomas Hoger 2015-04-08 11:27:26 UTC
This issue was introduced via this bug / commit:

https://bugs.php.net/bug.php?id=62978
http://git.php.net/?p=php-src.git;a=commitdiff;h=f718684a6c1d6221015031d1e72d3eb55ecbb659

in upstream PHP versions 5.4.20 and 5.5.2.  Therefore, this did not affect PHP packages as shipped with Red Hat Enterprise Linux 5, 6 and 7.

Statement:

This issue did not affect the versions of PHP as shipped with Red Hat Enterprise Linux 5, 6 and 7.

Comment 4 Tomas Hoger 2015-04-08 11:33:09 UTC
Upstream bug report indicates that this can be triggered with pg_insert() with NULL table name.  In addition to pg_insert(), build_tablename() is also called by pg_update(), pg_select() and pg_delete().  In all cases, code ensures that table name is not NULL.  However, php_strtok_r() can also return NULL if string only consists of delimiter characters (in this case, if table name only contains dots).  As noted in comment 2, table name is unlikely to come from untrusted source, and if it is, the PHP application likely has bigger issues.  Therefore, this has minimal impact.

Comment 8 Fedora Update System 2015-04-22 22:51:45 UTC
php-5.6.8-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 9 Fedora Update System 2015-04-23 16:10:58 UTC
php-5.6.8-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 10 Fedora Update System 2015-04-27 08:39:26 UTC
php-5.5.24-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 15 errata-xmlrpc 2015-06-04 08:07:01 UTC
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