PHP: Multiple vulnerabilities — GLSA 200412-14 Several vulnerabilities were found and fixed in PHP, ranging from an information leak and a safe_mode restriction bypass to a potential remote execution of arbitrary code. Affected packages Package dev-php/php on all architectures Affected versions < 4.3.10 Unaffected versions >= 4.3.10 Package dev-php/mod_php on all architectures Affected versions < 4.3.10 Unaffected versions >= 4.3.10 Package dev-php/php-cgi on all architectures Affected versions < 4.3.10 Unaffected versions >= 4.3.10 Background PHP is a general-purpose scripting language widely used to develop web-based applications. It can run inside a web server using the mod_php module or the CGI version of PHP, or can run stand-alone in a CLI. Description Stefan Esser and Marcus Boerger reported several different issues in the unserialize() function, including serious exploitable bugs in the way it handles negative references (CAN-2004-1019). Stefan Esser also discovered that the pack() and unpack() functions are subject to integer overflows that can lead to a heap buffer overflow and a heap information leak. Finally, he found that the way multithreaded PHP handles safe_mode_exec_dir restrictions can be bypassed, and that various path truncation issues also allow to bypass path and safe_mode restrictions. Ilia Alshanetsky found a stack overflow issue in the exif_read_data() function (CAN-2004-1065). Finally, Daniel Fabian found that addslashes and magic_quotes_gpc do not properly escape null characters and that magic_quotes_gpc contains a bug that could lead to one level directory traversal. Impact These issues could be exploited by a remote attacker to retrieve web server heap information, bypass safe_mode or path restrictions and potentially execute arbitrary code with the rights of the web server running a PHP application. Workaround There is no known workaround at this time. Resolution All PHP users should upgrade to the latest version: # emerge --sync # emerge --ask --oneshot --verbose ">=dev-php/php-4.3.10" All mod_php users should upgrade to the latest version: # emerge --sync # emerge --ask --oneshot --verbose ">=dev-php/mod_php-4.3.10" All php-cgi users should upgrade to the latest version: # emerge --sync # emerge --ask --oneshot --verbose ">=dev-php/php-cgi-4.3.10" References PHP 4.3.10 Release Announcement Hardened-PHP Security Advisory SEC Consult Advisory CAN-2004-1019 CAN-2004-1020 CVE-2004-1063 CVE-2004-1064 CVE-2004-1065