shell bypass 403
GrazzMean Shell
: /homepages/2/d455661007/htdocs/_ProviderRestore/altamira21_WEB_VIEJA/webadmin/includes/ [ drwx---r-x ]
<?
require_once 'global.lib.php';
require_once '../documentacion/config.php';
aut_verifica();
if(isset($_GET['archivo']) && $_GET['archivo'] != ''){
$archivo = strip_tags($_GET['archivo']);
if(strpos($archivo,"../")!==false)
die;
// if(function_exists('mysql_real_escape_string')){
// $archivo = mysql_real_escape_string(archivo);
// }
// else{
// $archivo = addslashes(archivo);
// }
// echo $archivo;
$temp = explode('/',$archivo);
// print_r($temp);
if(count($temp) == 2){
$archivo = $temp[1];
$directorio = $temp[0];
$SQL = "SELECT id,nombre FROM $directorio WHERE archivo = '$archivo'";
$c = @mysql_query($SQL);
if(mysql_num_rows($c) == 1){
$r = mysql_fetch_assoc($c);
$root = $_SERVER['DOCUMENT_ROOT']."/webadmin/filesdb/";
$path = $root.$directorio.'/'.$archivo;
$type = '';
$info = pathinfo($path);
if (is_file($path)) {
$size = filesize($path);
if (function_exists('mime_content_type')) {
$type = mime_content_type($path);
}
else if (function_exists('finfo_file')) {
$info = finfo_open(FILEINFO_MIME);
$type = finfo_file($info, $path);
finfo_close($info);
}
if ($type == '') {
$type = "application/force-download";
}
// Establecer Headers
header("Content-Type: $type");
header("Content-Disposition: attachment; filename={$r['nombre']}.{$info['extension']}");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . $size);
//Descargar archivo
readfile($path);
}
else {
die("File not exist !!");
}
}
else
die;
}
else
die;
}
else
die;
?>