PHP up to 7.0.5 ZIP Archive zend_string.h ZipArchive::getFromIndex integer overflow
| CVSS Meta Temp Score | Current Exploit Price (≈) | CTI Interest Score |
|---|---|---|
| 9.3 | $0-$5k | 0.00 |
Summary
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.
Details
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.
Product
Type
Name
Version
License
Website
- Product: https://www.php.org/
CPE 2.3
CPE 2.2
CVSSv4
VulDB Vector: 🔍VulDB Reliability: 🔍
CVSSv3
VulDB Meta Base Score: 9.8VulDB 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: 🔍
CVSSv2
| AV | AC | Au | C | I | A |
|---|---|---|---|---|---|
| 💳 | 💳 | 💳 | 💳 | 💳 | 💳 |
| 💳 | 💳 | 💳 | 💳 | 💳 | 💳 |
| 💳 | 💳 | 💳 | 💳 | 💳 | 💳 |
| Vector | Complexity | Authentication | Confidentiality | Integrity | Availability |
|---|---|---|---|---|---|
| Unlock | Unlock | Unlock | Unlock | Unlock | Unlock |
| Unlock | Unlock | Unlock | Unlock | Unlock | Unlock |
| Unlock | Unlock | Unlock | Unlock | Unlock | Unlock |
VulDB Base Score: 🔍
VulDB Temp Score: 🔍
VulDB Reliability: 🔍
NVD Base Score: 🔍
Exploiting
Class: Integer overflowCWE: 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-Day | Unlock | Unlock | Unlock | Unlock |
|---|---|---|---|---|
| Today | Unlock | Unlock | Unlock | Unlock |
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 Intelligence
Interest: 🔍Active Actors: 🔍
Active APT Groups: 🔍
Countermeasures
Recommended: UpgradeStatus: 🔍
Reaction Time: 🔍
0-Day Time: 🔍
Exposure Time: 🔍
Exploit Delay Time: 🔍
Upgrade: PHP 7.0.6
Patch: github.com
Timeline
03/10/2016 🔍04/28/2016 🔍
04/28/2016 🔍
04/28/2016 🔍
05/02/2016 🔍
05/24/2016 🔍
05/25/2016 🔍
08/07/2016 🔍
06/11/2024 🔍
Sources
Product: php.orgAdvisory: 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: 🔍
Entry
Created: 05/02/2016 08:53Updated: 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.
No comments yet. Languages: en.
Please log in to comment.