Bug 886060 - (CVE-2014-4698) VUL-0: CVE-2014-4698: php5,php53: ArrayIterator use-after-free due to object change during sorting
(CVE-2014-4698)
VUL-0: CVE-2014-4698: php5,php53: ArrayIterator use-after-free due to object ...
Status: RESOLVED FIXED
Classification: Novell Products
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents
unspecified
Other Other
: P3 - Medium : Normal
: ---
Assigned To: Security Team bot
Security Team bot
https://smash.suse.de/issue/103331/
maint:released:sle11-sp3:58371
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-07 14:59 UTC by Victor Pereira
Modified: 2020-05-18 11:53 UTC (History)
1 user (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Pereira 2014-07-07 14:59:52 UTC
CVE-2014-4698

Description:
------------
ArrayIterator should not be changed while being sorted.
There is a check missing in unserialize method in spl_array.c .



Test script:
---------------
<?php
$it = new ArrayIterator(array_fill(0,10,'X'), 1 );

function badsort($a, $b) {
        $GLOBALS['it']->unserialize($GLOBALS['it']->serialize());
        return TRUE;
}

$it->uksort('badsort');

Expected result:
----------------
Warning: Modification of ArrayObject during sorting is prohibited in spl_array.php on line 5

Actual result:
--------------
$ USE_ZEND_ALLOC=0 valgrind /opt/php/5.5.14/bin/php spl_array.php
==23209== Memcheck, a memory error detector
==23209== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==23209== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==23209== Command: /opt/php/5.5.14/bin/php spl_array.php
==23209==
==23209== Invalid read of size 4
==23209==    at 0x8374BAD: php_array_user_key_compare (array.c:736)
==23209==    by 0x849C8BC: zend_qsort_r (zend_qsort.c:84)
==23209==    by 0x849C9BE: zend_qsort (zend_qsort.c:123)
==23209==    by 0x8496368: zend_hash_sort (zend_hash.c:1463)
==23209==    by 0x837906B: zif_uksort (array.c:796)
==23209==    by 0x8479E7C: zend_call_function (zend_execute_API.c:955)
==23209==    by 0x6506747: ???
==23209==  Address 0x716c05c is 4 bytes inside a block of size 36 free'd
==23209==    at 0x402750C: free (vg_replace_malloc.c:427)
==23209==    by 0x8494B1A: zend_hash_destroy (zend_hash.c:565)
==23209==    by 0x84866E0: _zval_dtor_func (zend_variables.c:45)
==23209==    by 0x8477F47: _zval_ptr_dtor (zend_variables.h:35)
==23209==    by 0x8357D33: zim_spl_Array_unserialize (spl_array.c:1781)
==23209==    by 0x852E1B1: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:550)
==23209==    by 0x84F0935: execute_ex (zend_vm_execute.h:363)
==23209==    by 0x8479F14: zend_call_function (zend_execute_API.c:937)
==23209==    by 0x8374C11: php_array_user_key_compare (array.c:757)
==23209==    by 0x849C8BC: zend_qsort_r (zend_qsort.c:84)
==23209==    by 0x849C9BE: zend_qsort (zend_qsort.c:123)
==23209==    by 0x8496368: zend_hash_sort (zend_hash.c:1463)


References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-4698
http://people.canonical.com/~ubuntu-security/cve/2014/CVE-2014-4698.html
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-4698
Comment 1 Swamp Workflow Management 2014-07-07 22:01:04 UTC
bugbot adjusting priority
Comment 4 Petr Gajdos 2014-07-18 08:00:01 UTC
php 5.5.14 affected as well, submitted to factory and sle12.
Comment 5 Bernhard Wiedemann 2014-07-18 08:00:56 UTC
This is an autogenerated message for OBS integration:
This bug (886060) was mentioned in
https://build.opensuse.org/request/show/241423 Factory / php5
Comment 6 Petr Gajdos 2014-07-18 08:02:27 UTC
Packages submitted.
Comment 8 SMASH SMASH 2014-07-21 13:11:27 UTC
Affected packages:

SLE-11-SP3: php53
Comment 9 Swamp Workflow Management 2014-07-30 10:06:35 UTC
SUSE-SU-2014:0938-1: An update that fixes 9 vulnerabilities is now available.

Category: security (moderate)
Bug References: 884986,884987,884989,884990,884991,884992,885961,886059,886060
CVE References: CVE-2014-0207,CVE-2014-3478,CVE-2014-3479,CVE-2014-3480,CVE-2014-3487,CVE-2014-3515,CVE-2014-4670,CVE-2014-4698,CVE-2014-4721
Sources used:
SUSE Linux Enterprise Software Development Kit 11 SP3 (src):    php53-5.3.17-0.27.1
SUSE Linux Enterprise Server 11 SP3 for VMware (src):    php53-5.3.17-0.27.1
SUSE Linux Enterprise Server 11 SP3 (src):    php53-5.3.17-0.27.1
Comment 10 Victor Pereira 2014-07-30 12:14:04 UTC
fixed and released
Comment 11 Swamp Workflow Management 2014-07-30 18:46:18 UTC
openSUSE-SU-2014:0945-1: An update that fixes three vulnerabilities is now available.

Category: security (moderate)
Bug References: 885961,886059,886060
CVE References: CVE-2014-4670,CVE-2014-4698,CVE-2014-4721
Sources used:
openSUSE 13.1 (src):    php5-5.4.20-21.1
openSUSE 12.3 (src):    php5-5.3.17-3.25.1
Comment 12 Bernhard Wiedemann 2014-09-17 18:01:42 UTC
This is an autogenerated message for OBS integration:
This bug (886060) was mentioned in
https://build.opensuse.org/request/show/249993 Evergreen:11.4 / php5.openSUSE_Evergreen_11.4
Comment 13 Swamp Workflow Management 2014-09-28 10:09:12 UTC
openSUSE-SU-2014:1236-1: An update that fixes 9 vulnerabilities is now available.

Category: security (moderate)
Bug References: 884986,884987,884989,884990,884991,884992,885961,886059,886060
CVE References: CVE-2014-0207,CVE-2014-3478,CVE-2014-3479,CVE-2014-3480,CVE-2014-3487,CVE-2014-3515,CVE-2014-4670,CVE-2014-4698,CVE-2014-4721
Sources used:
openSUSE Evergreen 11.4 (src):    php5-5.3.17-379.1
Comment 14 Swamp Workflow Management 2016-06-21 11:10:26 UTC
SUSE-SU-2016:1638-1: An update that fixes 85 vulnerabilities is now available.

Category: security (important)
Bug References: 884986,884987,884989,884990,884991,884992,885961,886059,886060,893849,893853,902357,902360,902368,910659,914690,917150,918768,919080,921950,922451,922452,923945,924972,925109,928506,928511,931421,931769,931772,931776,933227,935074,935224,935226,935227,935229,935232,935234,935274,935275,938719,938721,942291,942296,945412,945428,949961,968284,969821,971611,971612,971912,973351,973792,976996,976997,977003,977005,977991,977994,978827,978828,978829,978830,980366,980373,980375,981050,982010,982011,982012,982013,982162
CVE References: CVE-2004-1019,CVE-2006-7243,CVE-2014-0207,CVE-2014-3478,CVE-2014-3479,CVE-2014-3480,CVE-2014-3487,CVE-2014-3515,CVE-2014-3597,CVE-2014-3668,CVE-2014-3669,CVE-2014-3670,CVE-2014-4049,CVE-2014-4670,CVE-2014-4698,CVE-2014-4721,CVE-2014-5459,CVE-2014-8142,CVE-2014-9652,CVE-2014-9705,CVE-2014-9709,CVE-2014-9767,CVE-2015-0231,CVE-2015-0232,CVE-2015-0273,CVE-2015-1352,CVE-2015-2301,CVE-2015-2305,CVE-2015-2783,CVE-2015-2787,CVE-2015-3152,CVE-2015-3329,CVE-2015-3411,CVE-2015-3412,CVE-2015-4021,CVE-2015-4022,CVE-2015-4024,CVE-2015-4026,CVE-2015-4116,CVE-2015-4148,CVE-2015-4598,CVE-2015-4599,CVE-2015-4600,CVE-2015-4601,CVE-2015-4602,CVE-2015-4603,CVE-2015-4643,CVE-2015-4644,CVE-2015-5161,CVE-2015-5589,CVE-2015-5590,CVE-2015-6831,CVE-2015-6833,CVE-2015-6836,CVE-2015-6837,CVE-2015-6838,CVE-2015-7803,CVE-2015-8835,CVE-2015-8838,CVE-2015-8866,CVE-2015-8867,CVE-2015-8873,CVE-2015-8874,CVE-2015-8879,CVE-2016-2554,CVE-2016-3141,CVE-2016-3142,CVE-2016-3185,CVE-2016-4070,CVE-2016-4073,CVE-2016-4342,CVE-2016-4346,CVE-2016-4537,CVE-2016-4538,CVE-2016-4539,CVE-2016-4540,CVE-2016-4541,CVE-2016-4542,CVE-2016-4543,CVE-2016-4544,CVE-2016-5093,CVE-2016-5094,CVE-2016-5095,CVE-2016-5096,CVE-2016-5114
Sources used:
SUSE Linux Enterprise Server 11-SP2-LTSS (src):    php53-5.3.17-47.1