CVE-2016-7124
Critical · 9.8CVSS
9.8
EPSS
16.6%
Published
Sep 12, 2016
CISA due date
—
Cloudanix analysis
A flaw in older PHP versions lets attackers send specially made data that can crash the application or cause other problems if the software is not updated.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Remote Code Execution
- Component
- Library
- Class
- Deserialization
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Mishandling of invalid objects during unserialization in ext/standard/var_unserializer.c allows crafted serialized data to trigger __destruct or other magic method calls, resulting in denial of service or further unspecified impact.
Why it matters to the business
Applications relying on PHP unserialization of untrusted data face risk of service outages and potential compromise, increasing operational costs and exposure for any systems still running unpatched versions years after disclosure.
How an attack unfolds
An attacker crafts a malicious serialized PHP object payload designed to exploit improper handling in the unserializer, then supplies it to any endpoint or input that performs unserialize on attacker-controlled data, leading to unexpected method invocations or crashes.
How to fix it
Upgrade PHP to version 5.6.25, 7.0.10 or later; for source builds apply commit 20ce2fe8e3c211a42fee05a461a5881be9a8790e. Disable unserialize on untrusted input where possible and use safe alternatives such as JSON.
How to confirm the fix worked
Confirm PHP version is at or above the fixed releases, review code for unserialize usage on external data, and test with known malicious serialized payloads to verify crashes or unexpected behavior no longer occur.
Typical attack path
- Identify an application endpoint accepting user-controlled serialized data
- Craft invalid object serialization that triggers magic methods or destructors
- Transmit the payload via network request to the vulnerable unserialize call
- Observe denial of service or attempt to escalate to additional impact
How to detect it
Review web server and application logs for unusually large or malformed serialized strings passed to unserialize functions; correlate with PHP process crashes or high CPU usage around the time of suspicious requests.
What your security team should do
- Immediately inventory all PHP deployments and prioritize upgrades to fixed versions
- Replace unserialize calls on untrusted data with safer deserialization methods
- Implement input validation and web application firewalls to block suspicious serialized payloads
- Monitor vulnerability feeds for any renewed exploit activity given the age and available public exploits
The record
ext/standard/var_unserializer.c in PHP before 5.6.25 and 7.x before 7.0.10 mishandles certain invalid objects, which allows remote attackers to cause a denial of service or possibly have unspecified other impact via crafted serialized data that leads to a (1) __destruct call or (2) magic method call.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:7 | php5 | 0 | 5.4.45-0+deb7u6 |
| Debian:8 | php5 | 0 | 5.6.26+dfsg-0+deb8u1 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56 | 0 | 0:2.3-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-bcmath | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-cli | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-common | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-dba | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-dbg | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-debuginfo | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-devel | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-embedded | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-enchant | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-fpm | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-gd | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-gmp | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-imap | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-intl | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-ldap | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-mbstring | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-mysqlnd | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-odbc | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-opcache | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-pdo | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-pear | 0 | 1:1.9.5-4.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-pgsql | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-process | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-pspell | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-recode | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-snmp | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-soap | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-tidy | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-xml | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-php-xmlrpc | 0 | 0:5.6.25-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-runtime | 0 | 0:2.3-1.el6 |
| Red Hat:rhel_software_collections:2::el6 | rh-php56-scldevel | 0 | 0:2.3-1.el6 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56 | 0 | 0:2.3-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-bcmath | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-cli | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-common | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-dba | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-dbg | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-debuginfo | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-devel | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-embedded | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-enchant | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-fpm | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-gd | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-gmp | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-intl | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-ldap | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-mbstring | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-mysqlnd | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-odbc | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-opcache | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-pdo | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-pear | 0 | 1:1.9.5-4.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-pgsql | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-process | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-pspell | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-recode | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-snmp | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-soap | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-xml | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-php-xmlrpc | 0 | 0:5.6.25-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-runtime | 0 | 0:2.3-1.el7 |
| Red Hat:rhel_software_collections:2::el7 | rh-php56-scldevel | 0 | 0:2.3-1.el7 |
| SUSE:Linux Enterprise Module for Web and Scripting 12 | php5 | 0 | 5.5.14-73.1 |
| SUSE:Linux Enterprise Module for Web and Scripting 12 | php7 | 0 | 7.0.7-15.1 |
| SUSE:Linux Enterprise Point of Sale 11 SP3 | php53 | 0 | 5.3.17-84.1 |
| SUSE:Linux Enterprise Server 11 SP2-LTSS | php53 | 0 | 5.3.17-55.1 |
| SUSE:Linux Enterprise Server 11 SP3-LTSS | php53 | 0 | 5.3.17-84.1 |
| SUSE:Linux Enterprise Server 11 SP3-TERADATA | php53 | 0 | 5.3.17-84.1 |
| SUSE:Linux Enterprise Server 11 SP4 | php53 | 0 | 5.3.17-84.1 |
| SUSE:Linux Enterprise Server for SAP Applications 11 SP4 | php53 | 0 | 5.3.17-84.1 |
| SUSE:Linux Enterprise Software Development Kit 11 SP4 | php53 | 0 | 5.3.17-84.1 |
| SUSE:Linux Enterprise Software Development Kit 12 SP1 | php5 | 0 | 5.5.14-73.1 |
| SUSE:Linux Enterprise Software Development Kit 12 SP1 | php7 | 0 | 7.0.7-15.1 |
| SUSE:Manager 2.1 | php53 | 0 | 5.3.17-84.1 |
| SUSE:Manager Proxy 2.1 | php53 | 0 | 5.3.17-84.1 |
| SUSE:OpenStack Cloud 5 | php53 | 0 | 5.3.17-84.1 |
| Ubuntu:14.04:LTS | php5 | 0 | 5.5.9+dfsg-1ubuntu4.20 |
| Ubuntu:16.04:LTS | php7.0 | 0 | 7.0.8-0ubuntu0.16.04.3 |
Related vulnerabilities
- CVE-2017-12933 The finish_nested_data function in ext/standard/var_unserializer.re in PHP before 5.6.31… Also affects php5
- CVE-2016-10158 The exif_convert_any_to_int function in ext/exif/exif.c in PHP before 5.6.30, 7.0.x… Also affects php5
- CVE-2016-10161 The object_common1 function in ext/standard/var_unserializer.c in PHP before 5.6.30… Also affects php5
- CVE-2016-7479 In all versions of PHP 7, during the unserialization process, resizing the 'properties'… Also affects php5
- CVE-2016-7478 Zend/zend_exceptions.c in PHP, possibly 5.x before 5.6.28 and 7.x before 7.0.13, allows… Also affects php5
- CVE-2016-7418 The php_wddx_push_element function in ext/wddx/wddx.c in PHP before 5.6.26 and 7.x before… Also affects php5
- CVE-2016-5771 spl_array.c in the SPL extension in PHP before 5.5.37 and 5.6.x before 5.6.23 improperly… Also affects php5
- CVE-2016-6296 Integer signedness error in the simplestring_addn function in simplestring.c in… Also affects php5