CVE-2015-3307: Buffer Overflow

Published May 20, 2015
·
Updated

A vulnerability in PHP was reported whereby the Heap header gets misaligned resulting in the corruption of the heap chunk's metadata.

A heap chunk is allocated in ext/phar/tar.c:167

metadata = (char ) safeemalloc(1, entry->uncompressedfilesize, 1);

A reference to this heap chunk is passed into pharparsemetadata() at ext/phar/tar.c:176

if (pharparsemetadata(&metadata, &entry->metadata, entry->uncompressedfilesize TSRMLSCC) == FAILURE) {

The following gets called within pharparsemetadata:611 when zipmetadatalen==0

PHARGET32(buffer, buflen);

This moves the pointer referencing the heap chunk by 4 bytes.

When the heap chunk gets freeed at at tar.c:177:

efree(metadata);

The heap chunk is now misaligned by 4 bytes. In other words: ZENDMMHEADEROF(metadata).info.size is now ZENDMMHEADEROF(metadata).info.prev and ZENDMMHEADEROF(metadata).info.prev is tainted with the body's data.

Upstream bug: https://bugs.php.net/bug.php?id=69443

Upstream patch: http://git.php.net/?p=php-src.git;a=commitdiff;h=17cbd0b5b78a7500f185b3781a2149881bfff8ae

This patch was for CVE-2015-2783 (bug 1213446), but it inadvertently resolved this vulnerability as well. The vulnerable line that was removed was on ext/phar/phar.c:611

PHARGET32(buffer, buflen);

Other sources

The pharparsemetadata function in ext/phar/phar.c in PHP before 5.4.40, 5.5.x before 5.5.24, and 5.6.x before 5.6.8 allows remote attackers to cause a denial of service (heap metadata corruption) or possibly have unspecified other impact via a crafted tar archive.

MITRE

Affected Software

61 affected componentsFixes available
redhat/php<5.4.40
5.4.40
redhat/php<5.5.24
5.5.24
redhat/php<5.6.8
5.6.8
redhat Enterprise Linux Desktop=7.0
redhat Enterprise Linux Hpc Node=7.0
redhat Enterprise Linux Hpc Node Eus=7.1
redhat Enterprise Linux Server=7.0
redhat Enterprise Linux Server Eus=7.1
redhat Enterprise Linux Workstation=7.0
redhat Enterprise Linux=6.0
redhat Enterprise Linux=7.0
Apple iOS and macOS<=10.10.4
PHP PHP<=5.4.39
PHP PHP=5.5.0
PHP PHP=5.5.0-alpha1
PHP PHP=5.5.0-alpha2
PHP PHP=5.5.0-alpha3
PHP PHP=5.5.0-alpha4
PHP PHP=5.5.0-alpha5
PHP PHP=5.5.0-alpha6
PHP PHP=5.5.0-beta1
PHP PHP=5.5.0-beta2
PHP PHP=5.5.0-beta3
PHP PHP=5.5.0-beta4
PHP PHP=5.5.0-rc1
PHP PHP=5.5.0-rc2
PHP PHP=5.5.1
PHP PHP=5.5.2
PHP PHP=5.5.3
PHP PHP=5.5.4
PHP PHP=5.5.5
PHP PHP=5.5.6
PHP PHP=5.5.7
PHP PHP=5.5.8
PHP PHP=5.5.9
PHP PHP=5.5.10
PHP PHP=5.5.11
PHP PHP=5.5.12
PHP PHP=5.5.13
PHP PHP=5.5.14
PHP PHP=5.5.18
PHP PHP=5.5.19
PHP PHP=5.5.20
PHP PHP=5.5.21
PHP PHP=5.5.22
PHP PHP=5.5.23
PHP PHP=5.6.0-alpha1
PHP PHP=5.6.0-alpha2
PHP PHP=5.6.0-alpha3
PHP PHP=5.6.0-alpha4
PHP PHP=5.6.0-alpha5
PHP PHP=5.6.0-beta1
PHP PHP=5.6.0-beta2
PHP PHP=5.6.0-beta3
PHP PHP=5.6.0-beta4
PHP PHP=5.6.2
PHP PHP=5.6.3
PHP PHP=5.6.4
PHP PHP=5.6.5
PHP PHP=5.6.6
PHP PHP=5.6.7

Event History

May 20, 2015
Data Sourced
via Red Hat·02:00 PM
DescriptionSeverityAffected Software
Jun 9, 2015
CVE Published
via MITRE·06:00 PM
Data Sourced
via MITRE·06:00 PM
Description

Frequently Asked Questions

1

What is the severity of CVE-2015-3307?

CVE-2015-3307 has a moderate severity rating, which indicates a potential impact on the affected systems.

2

How do I fix CVE-2015-3307?

To fix CVE-2015-3307, update PHP to a version higher than 5.4.40 or 5.5.24 or 5.6.8 depending on your installed version.

3

What versions of PHP are affected by CVE-2015-3307?

CVE-2015-3307 affects PHP versions earlier than 5.4.40, 5.5.24, and 5.6.8.

4

How does CVE-2015-3307 affect PHP applications?

CVE-2015-3307 can lead to heap corruption, which may result in unexpected behavior or crashes in PHP applications.

5

Is there a workaround for CVE-2015-3307?

There is no official workaround for CVE-2015-3307; the best mitigation is to update to a fixed version.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203