When you autoload classes with either __autoload
or spl_autoload_register
do you have to sanitize the data if the variable
used to initialize the class is dynamically initialized using explode($_SERVER['REQUEST_URI'])
?
Example:
$arr=explode($_SERVER['REQUEST_URI'],DIRECTORY_SEPARATOR);
$obj=new $arr[0];
__autoload
define('PATH',dirname(__FILE__).DIRECTORY_SEPARATOR);
function __autoload($class){if(file_exists(PATH.'library/'.$class.'.php');include(PATH.'library/'.$class.'.php');}
spl_autoload_register
define('PATH',dirname(__FILE__).DIRECTORY_SEPARATOR);
function myautoloader($class){if(file_exists(PATH.'library/'.$class.'.php');include(PATH.'library/'.$class.'.php');}
spl_autoload_register('myautoloader');
to my knowledge if you attempt site.com/../../../etc/passwd%00
it would simply give a 404 because there is no GET
parameter ?get=
Every thing I stated is most likely untrue on Windows Servers
because the path is different ..\..\..\
but is this correct if you talk about a Linux/BSD server
? If not, why not?