Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 482456 - dev-lang/php-5.5 "php.ini" has insecure default of "allow_url_fopen = On"
Summary: dev-lang/php-5.5 "php.ini" has insecure default of "allow_url_fopen = On"
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Default Configs (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo Security
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-25 21:14 UTC by Martin
Modified: 2013-08-27 12:36 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin 2013-08-25 21:14:38 UTC
dev-lang/php-5.5:

The default php.ini file for /etc/php/* has set:

allow_url_fopen = On

The website page

http://phpsec.org/projects/phpsecinfo/tests/allow_url_fopen.html

recommends that should be instead be set to Off.

Running with that set to Off has no adverse effect for my websites tests using php.


Reproducible: Always

Steps to Reproduce:
1.Emerge dev-lang/php
2./etc/php/*/php.ini have "allow_url_fopen = On"
3.
Actual Results:  
In /etc/php/*/php.ini

allow_url_fopen = On

Expected Results:  
In /etc/php/*/php.ini

allow_url_fopen = Off

See:

http://phpsec.org/projects/phpsecinfo/tests/allow_url_fopen.html
Comment 1 Chris Reffett (RETIRED) gentoo-dev Security 2013-08-25 21:20:43 UTC
I suppose this is significant enough to merit a change in the default config. @php: your thoughts?
Comment 2 Ole Markus With (RETIRED) gentoo-dev 2013-08-26 06:10:39 UTC
(In reply to Chris Reffett from comment #1)
> I suppose this is significant enough to merit a change in the default
> config. @php: your thoughts?

We have had this discussion before and the points worth mentioning are:

* allow_url_fopen was, a long time ago, split into allow_url_fopen and allow_url_include. The former is about file_get_contents et.al and the latter is about include http://....  The former is on by default, the latter is not.

* Like it or not, PHP is a programming language, and developers are able to shot themselves in all sorts of body parts. I do not see it as our job as a distribution to protect *developers* from themselves. I don't think we should recommend disabling curl on a system just because a developer can do eval(`curl $probablySafeStuff`);

Also, just because a website has security in its name does not mean they have a clue. Especially when their info seem to date back to 2007 or so ;)
Comment 3 Sergey Popov (RETIRED) gentoo-dev 2013-08-26 07:15:16 UTC
(In reply to Ole Markus With from comment #2)
> * Like it or not, PHP is a programming language, and developers are able to
> shot themselves in all sorts of body parts. I do not see it as our job as a
> distribution to protect *developers* from themselves. I don't think we
> should recommend disabling curl on a system just because a developer can do
> eval(`curl $probablySafeStuff`);

How about change this setting in php.ini-production only? Cause it is definitely good to have this settings Off by default on newly installed production servers.
Comment 4 Ole Markus With (RETIRED) gentoo-dev 2013-08-26 07:55:54 UTC
(In reply to Sergey Popov from comment #3)
> (In reply to Ole Markus With from comment #2)
> > * Like it or not, PHP is a programming language, and developers are able to
> > shot themselves in all sorts of body parts. I do not see it as our job as a
> > distribution to protect *developers* from themselves. I don't think we
> > should recommend disabling curl on a system just because a developer can do
> > eval(`curl $probablySafeStuff`);
> 
> How about change this setting in php.ini-production only? Cause it is
> definitely good to have this settings Off by default on newly installed
> production servers.

After the split between include and fopen, it is widely common to do stuff like json_decode(file_get_contents($someUrl)). Would you also suggest production servers should come with python's urllib off by default or ruby's open-uri?

Also, in general, I would need a really good reason to change any upstream default since upstream default is what people expect.

So I honestly do not understand why allow_url_fopen should be off on any kind of server.
Comment 5 Ole Markus With (RETIRED) gentoo-dev 2013-08-26 07:59:39 UTC
This is the last discussion we had about this: bug 332763
Comment 6 Sergey Popov (RETIRED) gentoo-dev 2013-08-27 12:36:27 UTC
Ok, agruments seems reasonable. Closing this as UPSTREAM, cause this default does not security issue itself, just can be used insecurely in applications(and this is application problem, not language itself)