Multiple Vulnerabilities in PHP Allow for Arbitrary Code Execution

ITS Advisory Number: 
Date(s) Issued: 
Friday, April 29, 2016
Multiple Vulnerabilities in PHP Allow for Arbitrary Code Execution

Multiple vulnerabilities have been discovered in PHP which could allow an attacker to potentially execute arbitrary code. PHP is a programming language originally designed for use in web-based applications with HTML content. PHP supports a wide variety of platforms and is used by numerous web-based software applications. Successfully exploiting these issues may allow remote attackers to execute arbitrary code in the context of a webserver.

Systems Affected: 
  • PHP 7 prior to 7.0.6
  • PHP 5 prior to 5.5.35
  • PHP 5 prior to 5.6.21
Large and medium government entities: 
Small government entities: 
Large and medium business entities: 
Small business entities: 
Home Users: 

Multiple vulnerabilities have been discovered in PHP, which could allow an attacker to execute remote code; PHP has released updates that addresses these vulnerabilities. These vulnerabilities include:

Prior to 5.5.35 and 5.6.21

  • Fixed bug (libgd: signedness vulnerability) (CVE-2016-3074)

Prior to 7.0.6

  • Fixed bug (libgd: signedness vulnerability) (CVE-2016-3074)
  • Fixed bug (integer overflow in ZipArchive::getFrom*) (CVE-2016-3078)

Successful exploitation of these vulnerabilities may allow remote attackers to execute arbitrary code in the context of the webserver. Other bugs fixed in the PHP Core for these versions may be found below:

  • Fixed bug (_zval_dtor_func: Assertion `(arr)->gc.refcount <= 1' failed).
  • Fixed bug (Crash on assert(new class{})).
  • Fixed bug (Reference is lost in "switch").
  • Fixed bug (Interfaces allow final and abstract functions).
  • Fixed bug (zend_objects_store_call_destructors operates on realloced memory, crashing).
  • Fixed bug (EG(error_zval) is not handled well).
  • Fixed bug (Multiple Heap Overflows in php_raw_url_encode/ php_url_encode).
  • Fixed bug (Null coalescing operator and ArrayAccess).
  • Fixed bug (Segmentation fault on ZTS with gethostbyname).
  • Fixed bug (inheritance and allow_null).
  • Fixed bug (Inheritance, traits and interfaces).
  • Fixed bug (Null coalescing operator and magic).
  • Fixed bug (Cannot access array keys while uksort()).
  • Fixed bug (ArrayAccess, isset() and the offsetExists method).
  • Fixed bug (__debugInfo with empty string for key gives error).
  • Fixed bug (ArrayObject and isset are not friends).
  • Fixed bug (Decorated/Nested Generator is Uncloseable in Finally).
  • Fixed bug (bcpowmod accepts negative scale and corrupts _one_ definition).
  • Fixed bug (CURLOPT_NOPROXY applied as long instead of string).
  • Fixed bug (DateInterval::format Segmentation fault).
  • Fixed bug (Out of bounds heap read access in exif header processing).
  • Fixed bug (IntlDateFormatter looses locale if pattern is set via constructor).
  • Fixed bug (Missing constant: IntlChar::NO_NUMERIC_VALUE).
  • Fixed bug , (Inconsistencies in return values of IntlChar methods).
  • Fixed bug (Stackoverflow in datefmt_create).
  • Fixed bug (Locale::lookup incorrectly returns en or en_US if locale is empty).
  • Fixed bug (selectordinal doesn't work with named parameters).
  • Fixed bug (Out-of-bounds reads in zif_grapheme_stripos with negative offset).
  • Fixed bug (Script hangs after max_execution_time).
  • Fixed bug (null ptr deref ZEND_RETURN_SPEC_CONST_HANDLER).
  • Fixed bug (Own PDOStatement implementation ignore __call()).
  • Fixed bug (Quotes inside comments not properly handled).
  • Fixed bug (dblib_handle_quoter needs to allocate an extra byte).
  • Add DBLIB-specific attributes for controlling timeouts.
  • Fixed bug (pdo_pgsql inefficient when getColumnMeta() is used).
  • Fixed bug (pg_fetch_object binds parameters before call constructor).
  • Fixed bug (Function pg_insert does not insert when column type = inet).
  • Fixed bug (Nested foreach assign-by-reference creates broken variables).
  • Fixed bug (Deserializing serialized SPLObjectStorage-Object can't access properties in PHP).
  • Fixed bug (Double-free in SplDoublyLinkedList::offsetSet).
  • Fixed bug (Cloned SplObjectStorage with overwritten getHash fails offsetExists()).
  • Fixed bug (SPL autoloader breaks class_exists()).
  • Fixed bug (array_fill optimization breaks implementation).
  • Fixed bug (Returning the same var twice from __sleep() produces broken serialized data).
  • Fixed bug (Unserialize crushes on restore object reference).
  • Fixed bug (str_replace returns an incorrect resulting array after a foreach by reference).
  • Fixed bug (header_register_callback() and register_shutdown_function()).
  • Fixed bug (Null pointer deref (segfault) in stream_context_get_default).
  • Fixed bug (Unserialize accepts wrongly data).
  • Fixed bug (Wrong arrays behaviour).
  • Fixed bug (substr_replace bug, string length).
  • Fixed bug (php_crypt() crashes if crypt_r() does not exist or _REENTRANT is not defined).
  • Fixed bug (xml_parse_into_struct segmentation fault).
  • After appropriate testing upgrade to the latest version of PHP
  • Apply the principle of Least Privilege to all systems and services
  • Verify no unauthorized system modifications have occurred on system before applying patch
  • Remind users not to visit websites or follow links provided by unknown or untrusted sources.
  • Do not open email attachments from unknown or untrusted sources.
  • Limit user account privileges to only those required.

NOTE: Visiting these links may trigger an IDS signature match for a Possible Encrypted Webshell Download. This is a false positive alert that is matching content on the pages below.