### 简要描述: 若IIS6 支持asp的话 可导致直接Getshell。 ### 详细说明: 在user/upload.php中 ``` public function upload_save() { //多文件 $ac = $this->input->get_post('ac', TRUE); if (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = './attachment/' . $ac . '/'.date('Ym').'/'.date('d').'/'; $file_name = $_FILES['Filedata']['name']; $file_size = @filesize($_FILES['Filedata']['tmp_name']); //获得文件扩展名 $file_ext = strtolower(trim(substr(strrchr($file_name, '.'), 1))); if($file_ext=='mp3' || $file_ext=='wma' || $file_ext=='m4a' || $file_ext=='f4a' || $file_ext=='mp4' || $file_ext=='flv' || $file_ext=='avi' || $file_ext=='asf' || $file_ext=='wmv' || $file_ext=='swf'){ //判断后缀 }else{ @unlink($tempFile); } //---------获取歌曲属性------------------ $djinfo=$this->CsdjSkins->djinfo(@iconv('utf-8','gbk',$tempFile)); if($djinfo){ $info=explode("|",$djinfo); $dx =$info[0]; $yz =$info[1]; $sc =$info[2]; } else { $dx =''; $yz =''; $sc =''; } //新文件名 $new_file_name = date("YmdHis") . '_' . rand(10000,...
### 简要描述: 若IIS6 支持asp的话 可导致直接Getshell。 ### 详细说明: 在user/upload.php中 ``` public function upload_save() { //多文件 $ac = $this->input->get_post('ac', TRUE); if (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = './attachment/' . $ac . '/'.date('Ym').'/'.date('d').'/'; $file_name = $_FILES['Filedata']['name']; $file_size = @filesize($_FILES['Filedata']['tmp_name']); //获得文件扩展名 $file_ext = strtolower(trim(substr(strrchr($file_name, '.'), 1))); if($file_ext=='mp3' || $file_ext=='wma' || $file_ext=='m4a' || $file_ext=='f4a' || $file_ext=='mp4' || $file_ext=='flv' || $file_ext=='avi' || $file_ext=='asf' || $file_ext=='wmv' || $file_ext=='swf'){ //判断后缀 }else{ @unlink($tempFile); } //---------获取歌曲属性------------------ $djinfo=$this->CsdjSkins->djinfo(@iconv('utf-8','gbk',$tempFile)); if($djinfo){ $info=explode("|",$djinfo); $dx =$info[0]; $yz =$info[1]; $sc =$info[2]; } else { $dx =''; $yz =''; $sc =''; } //新文件名 $new_file_name = date("YmdHis") . '_' . rand(10000, 99999) . '.' . $file_ext; $targetFile = str_replace('//','/',$targetPath) . $new_file_name; if(FTP_Fun==1){ //开启远程附件 $FTPUP['hostname'] = FTP_Server; $FTPUP['port'] = FTP_Port; $FTPUP['username'] = FTP_Name; $FTPUP['password'] = FTP_Pass; //$FTPUP['debug'] = TRUE; $FTPUP['passive'] = FTP_Ive; $this->ftp->connect($FTPUP); $targetPath = './attachment/' . $ac . '/'.date('Ymd').'/'; //----------创建目录------------------------ $Dirs=FTP_Dir; if(substr($Dirs,0,1)=='/') $Dirs=substr($Dirs,1); if(substr($Dirs,-1)=='/') $Dirs=substr($Dirs,0,-1); if(!empty($Dirs)) $Dirs.='/'; $All=explode("/",$targetPath); $Dir1='./'.$Dirs.$All[1].'/'; $this->ftp->mkdir($Dir1, DIR_WRITE_MODE); $Dir2=$Dir1.$All[2].'/'; $this->ftp->mkdir($Dir2, DIR_WRITE_MODE); $Dir3=$Dir2.$All[3].'/'; $this->ftp->mkdir($Dir3, DIR_WRITE_MODE); //----------上传文件------------------------ $this->ftp->mkdir($targetPath, DIR_WRITE_MODE); $this->ftp->upload($tempFile, $Dir3.$new_file_name); $this->ftp->close(); echo "/attachment/" . $ac . "/".date('Ymd')."/".$new_file_name."=cscms=".$dx."=cscms=".$yz."=cscms=".$sc; }else{ //本地附件 !is_dir(str_replace('//','/',$targetPath)) && mkdir(str_replace('//','/',$targetPath), 0755, true); if(!file_exists($targetPath.'index.html')){ @file_put_contents($targetPath.'index.html','cscms'); } @move_uploaded_file($tempFile,$targetFile); echo "/attachment/" . $ac . "/".date('Ym')."/".date('d')."/".$new_file_name."=cscms=".$dx."=cscms=".$yz."=cscms=".$sc; } } } ``` $ac 可控 然后 可以看到 路径是由$ac 和data 组成的。 这里由于是生成目录。 就算能截断也没用 况且还不能截断。。 在iis6 asp中 有解析洞 就是xx.asp/xx/xx.flv 都会当成asp来解析嘛。 虽然csdj 是php的 但是很多windows下IIS6的 支持php大部分都还是支持asp的。 这里来控制$ac [<img src="https://images.seebug.org/upload/201403/01120820ea19a5ee37462ce955dc629bed31ae73.jpg" alt="88.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201403/01120820ea19a5ee37462ce955dc629bed31ae73.jpg) 就在元素那里改把。。 type改了是没用了 就算改成了jogx也不能上传jpgx。。 然后 上传一个flv。 [<img src="https://images.seebug.org/upload/201403/01120952ddc9dc62ed955544b241564859380de9.jpg" alt="89.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201403/01120952ddc9dc62ed955544b241564859380de9.jpg) 上传后 就是这样的路径了。 如果IIS6 asp的话 这样的是可以解析的。。 但是我本地apache 就算了。 - - 至于这个路径的话。 "/attachment/" . $ac . "/".date('Ymd')."/".$new_file_name. attachment/yu.asp/2014/03/01/ 这些都是可以知道的。 $new_file_name. $new_file_name = date("YmdHis") . '_' . rand(10000, 99999) . '.' . $file_ext; 格式化的时间戳 20140301115658 2014年3月1日11点56分58秒 例如是这样的 这个也是可以知道的 上传的时候记录一下时间 然后就是_ 10000-99999的随机了 这里就需要爆破一下 然后就是最后的.flv ### 漏洞证明: 。嗯 说得很清楚了。