Bug 1092815 (CVE-2014-0185) - CVE-2014-0185 php: insecure default permissions on the FPM unix socket
Summary: CVE-2014-0185 php: insecure default permissions on the FPM unix socket
Keywords:
Status: CLOSED WONTFIX
Alias: CVE-2014-0185
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 1092816
TreeView+ depends on / blocked
 
Reported: 2014-04-30 03:31 UTC by Murray McAllister
Modified: 2023-05-12 03:23 UTC (History)
12 users (show)

Fixed In Version: php 5.4.28, php 5.5.12
Clone Of:
Environment:
Last Closed: 2014-05-12 19:43:40 UTC
Embargoed:


Attachments (Terms of Use)

Description Murray McAllister 2014-04-30 03:31:29 UTC
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 14:56:32 UTC
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-06 03:27:22 UTC
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 09:24:13 UTC
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 15:06:12 UTC
Any idea when this will get patched in el 5 and 6?

Comment 6 Tomas Hoger 2014-05-07 19:53:23 UTC
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 05:25:33 UTC
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 19:43:40 UTC
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.