Bugzilla – Bug 910659
VUL-0: CVE-2014-8142: php5: NULL pointer dereference in unserialize.c
Last modified: 2020-05-18 11:54:15 UTC
bugbot adjusting priority
We have to decide first how to resolve bug 907519.
Afected down to 10sp3.
Test: <?php var_dump(unserialize('a:6:{a:6:{s:3:"322";s:3:"bar";s:3:"bar";s:3:"foo";a:6:{a:6:{s:3:"322";s:3:"bar";s:3:"bar";s:3:"foo";s:3:"bar";a:6:{a:6:{s:3:"322";s:3:"bar";s:3:"bar";s:3:"foo";a:6:{a:6:{s:3:"322";s:3:"bar";s:3:"b22";s:3:"bar";s:3:"bar";s:3:"foo";s:3:"bar";a:6:{a:6:{s:3:"322";s:3:"bar";s:3:"bar";s:3:"foo";s:3:"bar";s:3:"bar";')); ?>
Patch: --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -59,7 +59,13 @@ static inline void var_push(php_unserialize_data_t *var_hashx, zval **rval) PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval) { - var_entries *var_hash = (*var_hashx)->last_dtor; + var_entries *var_hash; + + if (!var_hashx || !*var_hashx) { + return; + } + + var_hash = (*var_hashx)->last_dtor; #if VAR_ENTRIES_DBG fprintf(stderr, "var_push_dtor(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval)); #endif
Factory: fixed trough update to 5.6.4
Tested on sle12 and 13.2; patch fixes the problem there.
Alexander, this fix is not complete, see CVE-2015-0231. Could you please file another bug?
(In reply to Petr Gajdos from comment #8) > Alexander, this fix is not complete, see CVE-2015-0231. Could you please > file another bug? php bug for CVE-2015-0231: https://bugs.php.net/bug.php?id=68710
commit for CVE-2015-0231: http://git.php.net/?p=php-src.git;a=commitdiff;h=e63f7b47e1937821e75e9862284c3150e1b1d524;hp=fc6aa939f59c9be0febe0fa141629e49541bab8c
(In reply to Alexander Bergmann from comment #0) > PHP NULL pointer dereference in unserialize.c > > http://git.php.net/?p=php-src.git;a=commitdiff; > h=13f1c276ab72cf1a8a400fd013b9289d0018a340 The CVE-2015-0231 fix forced me to reread php-security@ threads and I have realized that this is not actually correct. This is just fixing another problem exposed by testcase from comment 4. So we have three issues here, as far as I can tell: (1) Null ptr deref (CVE not assigned?) https://bugs.php.net/bug.php?id=68545 http://git.php.net/?p=php-src.git;a=commitdiff;h=13f1c276ab72cf1a8a400fd013b9289d0018a340 (2) CVE-2014-8142: https://bugs.php.net/bug.php?id=68594 http://git.php.net/?p=php-src.git;a=commitdiff;h=630f9c33c23639de85c3fd306b209b538b73b4c9 (3) CVE-2015-0231: https://bugs.php.net/bug.php?id=68710 http://git.php.net/?p=php-src.git;a=commitdiff;h=e63f7b47e1937821e75e9862284c3150e1b1d524;hp=fc6aa939f59c9be0febe0fa141629e49541bab8c Security team, please double check.
TESTCASE summary: (In reply to Petr Gajdos from comment #11) > (1) Null ptr deref (CVE not assigned?) see comment 4 > (2) CVE-2014-8142: <?php for ($i=4; $i<100; $i++) { var_dump($i); $m = new StdClass(); $u = array(1); $m->aaa = array(1,2,&$u,4,5); $m->bbb = 1; $m->ccc = &$u; $m->ddd = str_repeat("A", $i); $z = serialize($m); $z = str_replace("bbb", "aaa", $z); var_dump($z); $y = unserialize($z); var_dump($y); } ?> > (3) CVE-2015-0231: <?php for ($i=4; $i<100; $i++) { $m = new StdClass(); $u = array(1); $m->aaa = array(1,2,&$u,4,5); $m->bbb = 1; $m->ccc = &$u; $m->ddd = str_repeat("A", $i); $z = serialize($m); $z = str_replace("aaa", "123", $z); $z = str_replace("bbb", "123", $z); $y = unserialize($z); $z = serialize($y); } ?> All testcases causes segfault for vulnerable php versions.
setting needinfo just for bugzilla testing purposes
This is an autogenerated message for OBS integration: This bug (910659) was mentioned in https://build.opensuse.org/request/show/282815 Factory / php5
Removing needinfo set for testing purposes.
Packages submitted.
An update workflow for this issue was started. This issue was rated as moderate. Please submit fixed packages until 2015-02-25. When done, reassign the bug to security-team@suse.de. https://swamp.suse.de/webswamp/wf/60653
openSUSE-SU-2015:0325-1: An update that fixes 5 vulnerabilities is now available. Category: security (moderate) Bug References: 907519,910659,911663,911664,914690 CVE References: CVE-2014-8142,CVE-2014-9426,CVE-2014-9427,CVE-2015-0231,CVE-2015-0232 Sources used: openSUSE 13.2 (src): php5-5.6.1-8.1 openSUSE 13.1 (src): php5-5.4.20-38.1
SUSE-SU-2015:0365-1: An update that fixes four vulnerabilities is now available. Category: security (important) Bug References: 907519,910659,911664,914690 CVE References: CVE-2014-8142,CVE-2014-9427,CVE-2015-0231,CVE-2015-0232 Sources used: SUSE Linux Enterprise Software Development Kit 12 (src): php5-5.5.14-11.3 SUSE Linux Enterprise Module for Web Scripting 12 (src): php5-5.5.14-11.3
SUSE-SU-2015:0370-1: An update that fixes three vulnerabilities is now available. Category: security (moderate) Bug References: 907519,910659,914690 CVE References: CVE-2014-8142,CVE-2015-0231,CVE-2015-0232 Sources used: SUSE Linux Enterprise Software Development Kit 11 SP3 (src): php53-5.3.17-0.33.1 SUSE Linux Enterprise Server 11 SP3 for VMware (src): php53-5.3.17-0.33.1 SUSE Linux Enterprise Server 11 SP3 (src): php53-5.3.17-0.33.1
http://www.inulledmyself.com/2015/02/exploiting-memory-corruption-bugs-in.html http://www.inulledmyself.com/2015/02/exploiting-memory-corruption-bugs-in_23.html updates seems to be released.
An update workflow for this issue was started. This issue was rated as moderate. Please submit fixed packages until 2015-04-13. When done, reassign the bug to security-team@suse.de. https://swamp.suse.de/webswamp/wf/61384
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