#VU39590 Permissions, Privileges, and Access Controls in PHP


Published: 2017-03-02 | Updated: 2020-08-08

Vulnerability identifier: #VU39590

Vulnerability risk: Medium

CVSSv3.1: 6.5 [CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C]

CVE-ID: CVE-2015-8994

CWE-ID: CWE-264

Exploitation vector: Network

Exploit availability: No

Vulnerable software:
PHP
Universal components / Libraries / Scripting languages

Vendor: PHP Group

Description

The vulnerability allows a remote authenticated user to execute arbitrary code.

An issue was discovered in PHP 5.x and 7.x, when the configuration uses apache2handler/mod_php or php-fpm with OpCache enabled. With 5.x after 5.6.28 or 7.x after 7.0.13, the issue is resolved in a non-default configuration with the opcache.validate_permission=1 setting. The vulnerability details are as follows. In PHP SAPIs where PHP interpreters share a common parent process, Zend OpCache creates a shared memory object owned by the common parent during initialization. Child PHP processes inherit the SHM descriptor, using it to cache and retrieve compiled script bytecode ("opcode" in PHP jargon). Cache keys vary depending on configuration, but filename is a central key component, and compiled opcode can generally be run if a script's filename is known or can be guessed. Many common shared-hosting configurations change EUID in child processes to enforce privilege separation among hosted users (for example using mod_ruid2 for the Apache HTTP Server, or php-fpm user settings). In these scenarios, the default Zend OpCache behavior defeats script file permissions by sharing a single SHM cache among all child PHP processes. PHP scripts often contain sensitive information: Think of CMS configurations where reading or running another user's script usually means gaining privileges to the CMS database.

Mitigation
Install update from vendor's website.

Vulnerable software versions

PHP: 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.28, 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.29, 7.0.0 - 7.0.14


External links
http://marc.info/?l=php-internals&m=147876797317925&w=2
http://marc.info/?l=php-internals&m=147921016724565&w=2
http://openwall.com/lists/oss-security/2017/02/28/1
http://seclists.org/oss-sec/2016/q4/343
http://seclists.org/oss-sec/2017/q1/520
http://bugs.php.net/bug.php?id=69090
http://ma.ttias.be/a-better-way-to-run-php-fpm/


Q & A

Can this vulnerability be exploited remotely?

Yes. This vulnerability can be exploited by a remote authenticated user via the Internet.

Is there known malware, which exploits this vulnerability?

No. We are not aware of malware exploiting this vulnerability.


Latest bulletins with this vulnerability