#324875: SA-2008-067 (#324824): Fix file inclusion vulnerability.

merge-requests/26/head
Angie Byron 2008-10-25 01:13:40 +00:00
parent 5101fd24a5
commit 63e8d1e3d3
1 changed files with 5 additions and 0 deletions

View File

@ -347,6 +347,11 @@ function conf_path($require_settings = TRUE, $reset = FALSE) {
}
$uri = explode('/', $_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['SCRIPT_FILENAME']);
if (strpos($_SERVER['HTTP_HOST'], '/') !== FALSE || strpos($_SERVER['HTTP_HOST'], '\\') !== FALSE) {
// A HTTP_HOST containing slashes may be an attack and is invalid.
header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
exit;
}
$server = explode('.', implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.')))));
for ($i = count($uri) - 1; $i > 0; $i--) {
for ($j = count($server); $j > 0; $j--) {