Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 509132 (CVE-2014-0185)

Summary: <dev-lang/php-{5.4.28,5.5.12}: privilege escalation in php-fpm due to insecure default config (CVE-2014-0185)
Product: Gentoo Security Reporter: Agostino Sarubbo <ago>
Component: VulnerabilitiesAssignee: Gentoo Security <security>
Status: RESOLVED FIXED    
Severity: critical CC: php-bugs
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://www.openwall.com/lists/oss-security/2014/04/29/5
Whiteboard: A1 [glsa]
Package list:
Runtime testing required: ---

Description Agostino Sarubbo gentoo-dev 2014-04-30 07:26:57 UTC
From ${URL} :

PHP FPM is the FastCGI Process Manager for PHP which can manage several
pools of PHP FastCGI processors, often running with different user
permissions for privilege separation. Web servers connect to these pools
through one socket per configured process pool.

When using UNIX sockets, the socket's permissions default to 0666 if not
overriden explicitly ("listen.mode"). This is true even if the owner of
the socket is changed explicitly ("listen.user", "listen.group").

Depending on the concrete scenario, this may result in privilege escalation.
Any local user with the ability to connect to UNIX sockets can run
arbitrary (PHP) code with the target process pool's permissions [1].

Ubuntu 14.04 Beta's default config seems to be vulnerable, any local
user can run code as the 'www-data' user [2]. Other versions or
distributions have not been tested, but may well be vulnerable, too.

This issue is both about the example config [3] and the actual code [4].

No CVE has been requested by me or the PHP team (AFAIK) so far.

Stanislav Malyshev from the PHP team has prepared a patch [5], which
will be part of php-5.4.28.

This issue is not public yet. Suggested embargo date: 2014-04-29

References (some still marked private at the time of writing):

[1] https://bugs.php.net/bug.php?id=67060
[2] https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1307027
[3]
https://github.com/php/php-src/blob/php-5.5.11/sapi/fpm/php-fpm.conf.in#L172
[4]
https://github.com/php/php-src/blob/php-5.5.11/sapi/fpm/fpm/fpm_unix.c#L31
[5]
https://hoffmann-christian.info/files/php-fpm/0001-Fix-bug-67060-use-default-mode-of-660.patch



@maintainer(s): after the bump, in case we need to stabilize the package, please let us know if it is ready for the stabilization or not.
Comment 1 Agostino Sarubbo gentoo-dev 2014-05-06 12:57:58 UTC
5.4.28 and 5.5.12 seems to fix the problem. Is fine to stabilize them?
Comment 2 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2014-05-16 05:35:58 UTC
so, is it fine to stablize?
Comment 3 Ole Markus With (RETIRED) gentoo-dev 2014-05-18 14:49:03 UTC
(In reply to Matthew Thode ( prometheanfire ) from comment #2)
> so, is it fine to stablize?

I am sorry this slipped past me. Yes. It is fine to stabilise.
Comment 4 Yury German Gentoo Infrastructure gentoo-dev 2014-05-20 01:21:13 UTC
Arches, please test and mark stable:

=dev-lang/php-5.4.28
=dev-lang/php-5.5.12

Target Keywords : "alpha amd64 arm hppa ia64 ppc ppc64 spark x86"

Thank you!
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2014-05-20 20:44:01 UTC
Stable for HPPA.
Comment 6 Agostino Sarubbo gentoo-dev 2014-05-24 09:04:58 UTC
amd64 stable
Comment 7 Markus Meier gentoo-dev 2014-05-25 18:51:48 UTC
arm stable
Comment 8 Agostino Sarubbo gentoo-dev 2014-06-08 10:32:56 UTC
alpha stable
Comment 9 Agostino Sarubbo gentoo-dev 2014-06-08 10:42:22 UTC
ia64 stable
Comment 10 Agostino Sarubbo gentoo-dev 2014-06-08 10:46:00 UTC
ppc64 stable
Comment 11 Agostino Sarubbo gentoo-dev 2014-06-08 10:49:19 UTC
ppc stable
Comment 12 Agostino Sarubbo gentoo-dev 2014-06-08 10:51:55 UTC
sparc stable
Comment 13 Agostino Sarubbo gentoo-dev 2014-06-08 10:59:54 UTC
x86 stable.

Maintainer(s), please cleanup.
Security, please add it to the existing request, or file a new one.
Comment 14 Yury German Gentoo Infrastructure gentoo-dev 2014-06-17 18:01:02 UTC
Arches, Thank you for your work
Maintainer(s), please drop the vulnerable version.

Added to existing GLSA Request
Comment 15 GLSAMaker/CVETool Bot gentoo-dev 2014-06-17 18:02:20 UTC
CVE-2014-0185 (http://nvd.nist.gov/nvd.cfm?cvename=CVE-2014-0185):
  sapi/fpm/fpm/fpm_unix.c in the FastCGI Process Manager (FPM) in PHP before
  5.4.28 and 5.5.x before 5.5.12 uses 0666 permissions for the UNIX socket,
  which allows local users to gain privileges via a crafted FastCGI client.
Comment 16 Kristian Fiskerstrand (RETIRED) gentoo-dev 2014-08-15 15:26:34 UTC
No vulnerable version in 5.4 and 5.5 branch left in tree. 5.3 branch is not treated in this bug but rather in bug 519932
Comment 17 GLSAMaker/CVETool Bot gentoo-dev 2014-08-31 11:27:41 UTC
This issue was resolved and addressed in
 GLSA 201408-11 at http://security.gentoo.org/glsa/glsa-201408-11.xml
by GLSA coordinator Kristian Fiskerstrand (K_F).