PHP up to 7.0.5 ZIP Archive zend_string.h ZipArchive::getFromIndex integer overflow

CVSS Meta Temp Score
CVSS is a standardized scoring system to determine possibilities of attacks. The Temp Score considers temporal factors like disclosure, exploit and countermeasures. The unique Meta Score calculates the average score of different sources to provide a normalized scoring system.
Current Exploit Price (≈)
Our analysts are monitoring exploit markets and are in contact with vulnerability brokers. The range indicates the observed or calculated exploit price to be seen on exploit markets. A good indicator to understand the monetary effort required for and the popularity of an attack.
CTI Interest Score
Our Cyber Threat Intelligence team is monitoring different web sites, mailing lists, exploit markets and social media networks. The CTI Interest Score identifies the interest of attackers and the security community for this specific vulnerability in real-time. A high score indicates an elevated risk to be targeted for this vulnerability.
9.3$0-$5k0.00

Summaryinfo

A vulnerability classified as critical has been found in PHP up to 7.0.5. This vulnerability affects the function ZipArchive::getFromIndex of the file zend_string.h of the component ZIP Archive Handler. The manipulation leads to integer overflow. This vulnerability is referenced as CVE-2016-3078. Remote exploitation of the attack is possible. Furthermore, an exploit is available. It is recommended to upgrade the affected component.

Detailsinfo

A vulnerability was found in PHP up to 7.0.5 (Programming Language Software) and classified as critical. This issue affects the function ZipArchive::getFromIndex of the file zend_string.h of the component ZIP Archive Handler. The manipulation with an unknown input leads to a integer overflow vulnerability. Using CWE to declare the problem leads to CWE-190. The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. Impacted is confidentiality, integrity, and availability.

The weakness was published 04/28/2016 by Hans Jerry Illikainen (Website). It is possible to read the advisory at openwall.com. The public release has been coordinated with the project team. The identification of this vulnerability is CVE-2016-3078 since 03/10/2016. The attack may be initiated remotely. No form of authentication is needed for a successful exploitation. Technical details as well as a public exploit are known. The following code is the reason for this vulnerability:

static zend_always_inline zend_string *zend_string_alloc(size_t len, int persistent)
{
   zend_string *ret = (zend_string *)pemalloc(ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent); // (4)
   ...
   ZSTR_LEN(ret) = len;                                                                                  // (5)
   return ret;
}
The advisory points out:
The `size' argument to the `pemalloc' macro is aligned/adjusted in (4) whilst the *original* value of `len' is stored as the size of the allocated buffer in (5). No boundary checking is done in (4) and it may thus wrap, which would lead to a heap overflow during the invocation of `zip_fread()' in (3) as the `toread' argument is `ZSTR_LEN(buffer).

A public exploit has been developed by Hans Jerry Illikainen in Python and been published immediately after the advisory. The exploit is available at exploit-db.com. It is declared as proof-of-concept. We expect the 0-day to have been worth approximately $25k-$100k. The vulnerability scanner Nessus provides a plugin with the ID 91320 (Ubuntu 12.04 LTS / 14.04 LTS / 15.10 / 16.04 LTS : php5, php7.0 vulnerabilities (USN-2984-1)), which helps to determine the existence of the flaw in a target environment. It is assigned to the family Ubuntu Local Security Checks and running in the context l. The commercial vulnerability scanner Qualys is able to test this issue with plugin 196483 (Ubuntu Security Notification for Php5, Php7.0 Vulnerabilities (USN-2984-1)). The code used by the exploit is:

$zip = new ZipArchive();
if ($zip->open($_FILES["file"]["tmp_name"]) !== TRUE) {
   echo "cannot open archive\n";
} else {
   for ($i = 0; $i < $zip->numFiles; $i++) {
      $data = $zip->getFromIndex($i);
}
$zip->close();

Upgrading to version 7.0.6 eliminates this vulnerability. A possible mitigation has been published 4 weeks after the disclosure of the vulnerability.

The vulnerability is also documented in the databases at Exploit-DB (39742), Tenable (91320) and SecurityTracker (ID 1035701†). Similar entries are available at VDB-83181, VDB-87586 and VDB-90603. Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.

Productinfo

Type

Name

Version

License

Website

CPE 2.3info

CPE 2.2info

CVSSv4info

VulDB Vector: 🔍
VulDB Reliability: 🔍

CVSSv3info

VulDB Meta Base Score: 9.8
VulDB Meta Temp Score: 9.3

VulDB Base Score: 9.8
VulDB Temp Score: 8.8
VulDB Vector: 🔍
VulDB Reliability: 🔍

NVD Base Score: 9.8
NVD Vector: 🔍

CVSSv2info

AVACAuCIA
💳💳💳💳💳💳
💳💳💳💳💳💳
💳💳💳💳💳💳
VectorComplexityAuthenticationConfidentialityIntegrityAvailability
UnlockUnlockUnlockUnlockUnlockUnlock
UnlockUnlockUnlockUnlockUnlockUnlock
UnlockUnlockUnlockUnlockUnlockUnlock

VulDB Base Score: 🔍
VulDB Temp Score: 🔍
VulDB Reliability: 🔍

NVD Base Score: 🔍

Exploitinginfo

Class: Integer overflow
CWE: CWE-190 / CWE-189
CAPEC: 🔍
ATT&CK: 🔍

Physical: No
Local: No
Remote: Yes

Availability: 🔍
Access: Public
Status: Proof-of-Concept
Author: Hans Jerry Illikainen
Programming Language: 🔍
Download: 🔍

EPSS Score: 🔍
EPSS Percentile: 🔍

Price Prediction: 🔍
Current Price Estimation: 🔍

0-DayUnlockUnlockUnlockUnlock
TodayUnlockUnlockUnlockUnlock

Nessus ID: 91320
Nessus Name: Ubuntu 12.04 LTS / 14.04 LTS / 15.10 / 16.04 LTS : php5, php7.0 vulnerabilities (USN-2984-1)
Nessus File: 🔍
Nessus Risk: 🔍
Nessus Family: 🔍
Nessus Context: 🔍

OpenVAS ID: 803381
OpenVAS Name: PHP Denial of Service Vulnerability - 01 - Aug16 (Linux)
OpenVAS File: 🔍
OpenVAS Family: 🔍

Qualys ID: 🔍
Qualys Name: 🔍

Exploit-DB: 🔍

Threat Intelligenceinfo

Interest: 🔍
Active Actors: 🔍
Active APT Groups: 🔍

Countermeasuresinfo

Recommended: Upgrade
Status: 🔍

Reaction Time: 🔍
0-Day Time: 🔍
Exposure Time: 🔍
Exploit Delay Time: 🔍

Upgrade: PHP 7.0.6
Patch: github.com

Timelineinfo

03/10/2016 🔍
04/28/2016 +49 days 🔍
04/28/2016 +0 days 🔍
04/28/2016 +0 days 🔍
05/02/2016 +4 days 🔍
05/24/2016 +22 days 🔍
05/25/2016 +1 days 🔍
08/07/2016 +74 days 🔍
06/11/2024 +2865 days 🔍

Sourcesinfo

Product: php.org

Advisory: USN-2984-1
Researcher: Hans Jerry Illikainen
Status: Confirmed
Confirmation: 🔍
Coordinated: 🔍

CVE: CVE-2016-3078 (🔍)
GCVE (CVE): GCVE-0-2016-3078
GCVE (VulDB): GCVE-100-83075
SecurityTracker: 1035701

scip Labs: https://www.scip.ch/en/?labs.20161013
See also: 🔍

Entryinfo

Created: 05/02/2016 08:53
Updated: 06/11/2024 12:06
Changes: 05/02/2016 08:53 (82), 03/22/2019 14:03 (12), 07/27/2022 14:54 (5), 07/27/2022 14:55 (1), 06/11/2024 12:06 (15)
Complete: 🔍
Cache ID: 216::103

Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.

Discussion

No comments yet. Languages: en.

Please log in to comment.

Might our Artificial Intelligence support you?

Check our Alexa App!