|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-09-13 01:16 UTC] chrysalis at chrysalisnet dot org
Description:
------------
open_basedir is not working on include eg. include("/etc/passwd");, displays the appropriate denied in error log but doesnt actually block the code and can access files outside of open_basedir.
Reproduce code:
---------------
<?
include("/etc/passwd");
?>
Expected result:
----------------
a blank page as what happens on php 5.1.5
Actual result:
--------------
it displays the full contents of the /etc/passwd file.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 15:00:01 2025 UTC |
ok here is info your requested include("/etc/passwd"); is the exact line I used in the php file, this generates the following in the apache error_log for the vhost. [Wed Sep 13 20:51:48 2006] [error] PHP Warning: main() [<a href='function.main'>function.main</a>]: open_basedir restriction in effect. File(/etc/passwd) is not within the allowed path(s): (/home/chrysalis/:/tmp/:/var/www/:/var/uebimiau:/usr/local/lib/php/:/etc/virtual/:/usr/uebimiau) in /home/chrysalis/domains/chrysalisnet.org/public_html/exploit.php on line 17 [Wed Sep 13 20:51:48 2006] [error] PHP Warning: main(/etc/passwd) [<a href='function.main'>function.main</a>]: failed to open stream: Operation not permitted in /home/chrysalis/domains/chrysalisnet.org/public_html/exploit.php on line 17 this indicates to me open_basedir is in effect as its generating the correct log entry but then the /etc/passwd is displayed in the browser window. in phpinfo I get the following data for open_basedir local value. open_basedir /home/chrysalis/:/tmp/:/var/www/:/var/uebimiau:/usr/local/lib/php/:/etc/virtual/:/usr/uebimiau master value is the same with 1 extra dir /etc/awstats url temporarily up for your conveniance http://www.chrysalisnet.org/phpinfo.php the master value is set in php.ini the local value is set in a vhost container in httpd.conf using "php_admin_value open_basedir" I checked the exact same script on php 5.1.5 which has the same php settings other then php 5 specific settings and works as it should, I am about to try with php 4.4.3 to see if that has the same behaviour.