Bug 1092815 - (CVE-2014-0185) CVE-2014-0185 php: insecure default permissions on the FPM unix socket
CVE-2014-0185 php: insecure default permissions on the FPM unix socket
Status: CLOSED WONTFIX
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
medium Severity medium
: ---
: ---
Assigned To: Red Hat Product Security
impact=moderate,public=20140430,repor...
: Security
Depends On:
Blocks: 1092816
  Show dependency treegraph
 
Reported: 2014-04-29 23:31 EDT by Murray McAllister
Modified: 2015-08-17 10:26 EDT (History)
12 users (show)

See Also:
Fixed In Version: php 5.4.28, php 5.5.12
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-05-12 15:43:40 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Murray McAllister 2014-04-29 23:31:29 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.)

Acknowledgements:

Red Hat would like to thank Christian Hoffmann for reporting this issue.
Comment 2 Vincent Danen 2014-05-01 10:56:32 EDT
This was fixed in upstream 5.5.12:

http://www.php.net/ChangeLog-5.php#5.5.12

via the following commit:

https://github.com/php/php-src/commit/35ceea928b12373a3b1e3eecdc32ed323223a40d
Comment 3 Fedora Update System 2014-05-05 23:27:22 EDT
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.
Comment 4 Tomas Hoger 2014-05-07 05:24:13 EDT
Upstream bug report:
https://bugs.php.net/bug.php?id=67060

Related Ubuntu bug report:
https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1307027
Comment 5 bharper 2014-05-07 11:06:12 EDT
Any idea when this will get patched in el 5 and 6?
Comment 6 Tomas Hoger 2014-05-07 15:53:23 EDT
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:

http://git.php.net/?p=php-src.git;a=blob;f=sapi/fpm/php-fpm.conf.in;h=c5f4abc;hb=refs/heads/PHP-5.5.12#l151

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.
Comment 8 Fedora Update System 2014-05-12 01:25:33 EDT
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.
Comment 9 Tomas Hoger 2014-05-12 15:43:40 EDT
Statement:

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.

Note You need to log in before you can comment on or make changes to this bug.