Red Hat Bugzilla – Bug 1092815
CVE-2014-0185 php: insecure default permissions on the FPM unix socket
Last modified: 2015-08-17 10:26:28 EDT
It was reported that, on some distributions, PHP FPM (a FastCGI Process Manager for PHP) used a UNIX socket with insecure, default permissions. This would allow local users to execute PHP scripts with the privileges of the "apache" user. This is a similar situation to using mod_php where users can place scripts in their "~/public_html/" directory.
Original report: http://www.openwall.com/lists/oss-security/2014/04/29/5
On Red Hat Enterprise Linux 6, when using the Apache HTTP Server with mod_php, the use of "~/public_html/" is disabled by default; however, the default FPM configuration is more open, allowing users to talk directly to FPM and have their PHP scripts executed. (Note that there is currently no fastcgi module for the Apache HTTP Server in Red Hat Enterprise Linux 6, or for any other web server.)
Red Hat would like to thank Christian Hoffmann for reporting this issue.
This was fixed in upstream 5.5.12:
via the following commit:
php-5.5.12-1.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.
Upstream bug report:
Related Ubuntu bug report:
Any idea when this will get patched in el 5 and 6?
We are still considering this issue, but it seems this will not get fixed at all.
The php packages (both php and php53) in Red Hat Enterprise Linux 5 are not affected, as they do not include FPM.
The php packages in Red Hat Enterprise Linux 6 include FPM, packaged in separate sub-rpm named php-fpm. Those packages contain the issue.
The php-fpm packages are not required by typically installed php (containing httpd module) or php-cli (containing php-cgi) packages. If php-fpm installed, php-fpm service is not enabled by default.
Red Hat Enterprise Linux 6 does not provide any FastCGI module for httpd, or other web server with FastCGI support. Hence php-fpm are only distributed via unsupported Optional channel.
The default configuration of php-fpm in Red Hat Enterprise Linux and Fedora does not use unix socket to listen for requests. Network socket is used instead, with FPM listening on 127.0.0.1:9000 by default. This configuration is consistent with the upstream default, which seems to remain unchanged in 5.5.12:
Note that this configuration is also affected by the problem CVE-2014-0185 attempts to address - it allows any local user to execute PHP scripts with the privileges of the user FPM is configured to use. Upstream fix does not address this problem in the upstream default configuration in any way.
It should also be noted that the default configuration with FPM configured to run with httpd user privileges is consistent with typical httpd + mod_php configurations with UserDir enabled, that also allow local users to run php scripts with httpd user privileges.
We also expected the change to negatively impact deployments using FPM with other web server (such as nginx or lighttpd), and FPM configured to listen on unix socket rather than network socket. Those are configurations where FPM and web server run under different users. Bug 1095239 reported shortly after 5.5.12 update was pushed to Fedora confirms the expectation.
In conclusion, the risks of applying the change to Red Hat Enterprise Linux 6 php packages is high compared to the benefits of the fix.
Note that the default FPM configuration in our php packages may not change soon from using network socket to using unix socket by default. The httpd's mod_proxy_fcgi (available in httpd 2.4) does not (yet) support unix sockets.
Anyone deploying FPM should adjust the listen configuration according to the needs of their specific deployments, taking into account what types of sockets web server used can use, and if system has untrusted local users. The default unix socket permissions are explicitly listed in a comment in the default configuration file.
php-5.5.12-1.fc19 has been pushed to the Fedora 19 stable repository. If problems still persist, please make note of it in this bug report.
This issue did not affect the php and php53 packages as shipped with Red Hat Enterprise Linux 5. This issue is not planned to be addressed in the php packages in Red Hat Enterprise Linux 6 and 7. Refer to https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2014-0185 for further details.