Bug #68092 [Com]: chmod still works after being disabled via disable_functions
| From: | software-php at interfasys dot ch | Date: | Mon, 06 Oct 2014 11:33:25 +0000 |
| Subject: | Bug #68092 [Com]: chmod still works after being disabled via disable_functions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187880@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68092&edit=1
ID: 68092
Comment by: software-php at interfasys dot ch
Reported by: software-php at interfasys dot ch
Summary: chmod still works after being disabled via
disable_functions
Status: Not a bug
Type: Bug
Package: PHP options/info functions
Operating System: FreeBSD
PHP Version: 5.4.33
Block user comment: N
Private report: N
New Comment:
There are 2 problems with your test
#1 You did not add disable_functions to a php.ini section. That's where there might be a
problem. It's still php.ini (the only location where disable_functions works), so should be
supported or clearly stated as not working
--INI--
[HOST=my.web.site]
disable_functions = "chmod"
#2 Your test did not test phpinfo() to see if chmod was being reported as being disabled. In my test
it was shown as disabled (via the GUI), indicating that php.ini sections settings were properly
picked up, but not properly applied.
--FILE--
<? php
echo 'disable_functions = ' . ini_get('disable_functions') .
"</br>";
echo 'Is chmod allowed? ' . function_exists('chmod') . "</br>";
Now if I go to my.web.site/test.php, I get this
disable_functions = chmod
Is chmod allowed? 1
instead of
disable_functions = chmod
Is chmod allowed? 0
Previous Comments:
------------------------------------------------------------------------
[2014-10-06 08:21:30] datibbaw@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
The following test case works as expected:
--TEST--
Test chmod() when disabled
--INI--
disable_functions = "chmod"
--FILE--
<?php
chmod(__FILE__, 0644);
--EXPECTF--
Warning: chmod() has been disabled for security reasons in %s on line %d
------------------------------------------------------------------------
[2014-09-24 20:19:57] software-php at interfasys dot ch
Description:
------------
I'm using PHP-FPM 5.4.33
In a secondary ini file add a section which will apply to one website and disable chmod
[HOST=my.web.site]
disable_functions = "chmod"
Check that the function is disabled via phpinfo()
In my case, the local value for disable_functions shows "chmod"
Create a simple script which chmods a file
Test script:
---------------
if (!ini_get('display_errors')) {
ini_set('display_errors', '1');
}
echo ini_get('display_errors');
echo "I am chowning a file";
chmod("testcase.php", 0777);
Expected result:
----------------
I should get an error message telling me that this is not allowed
Actual result:
--------------
The file is chowned to 777.
Not that if the same function is added to Suhosin's blacklist, then I will get the proper
warning:
"Warning: chmod() has been disabled for security reasons"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68092&edit=1