From: guth at fiifo dot u-psud dot fr
Operating system: Linux
PHP version: 5.0.2
PHP Bug Type: Zend Engine 2 problem
Bug description: Includes are not binary safe
Description:
------------
hello,
includes (include, require, etc.) are not binary safe.
It is very dangerous for beginners, who often use includes with
parameters.
In the following example, i kwow that you can test the file name with
pathinfo() but the current PHP behaviour is incorrect.
Reproduce code:
---------------
<?php
$file = $_GET['file'];
$path = $_SERVER['DOCUMENT_ROOT']."/includes/".$file.".class.php";
if(is_file($path)) {
include $path;
}
?>
Expected result:
----------------
index.php?file=Forum
Should work.
I suppose that the directory backups/Database.xml is protected by a
.htaccess and is not accessible with your browser.
index.php?file=../backups/Dabatase.xml%00
Should not work.
Actual result:
--------------
index.php?file=Forum
Should work.
index.php?file=../backups/Dabatase.xml%00
Works !
--
Edit bug report at http://bugs.php.net/?id=30489&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30489&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30489&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30489&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30489&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30489&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30489&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30489&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30489&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30489&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30489&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30489&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30489&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30489&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30489&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30489&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30489&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30489&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30489&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30489&r=mysqlcfg