主页 > 网络知识 > MetInfo5.3.19代码审计思路(4)

MetInfo5.3.19代码审计思路(4)

 

MetInfo5.3.19代码审计思路

 

$mailurl的值并没有输出出来

后来百度了后才知道还得GET传参met_host=公网ip,然后公网ip的主机监听80端口,并捕获该端口上的HTTP流量,才能得到$mailurl的值,就像这样

 

MetInfo5.3.19代码审计思路

 

(此图来源百度)

但是找不到分析漏洞成因的文章,只有复现的文章,我也不知道为啥公网ip监听后就能得到这个$mailurl

0×05 后台cookie欺骗(不存在)

登录后台后发现有如下cookie

 

MetInfo5.3.19代码审计思路

 

经测试后发现met_auth和met_key这两个值要都存在才能访问后台,少了任意一个都会跳转到登录界面,于是全局搜索看看这两个是哪来的

 

MetInfo5.3.19代码审计思路

 

 

MetInfo5.3.19代码审计思路

 

$met_key=met_rand(7);rand?嗯,打扰了…

0×06 后台文件上传(不存在)

在后台发布内容处发现有一个上传点

 

MetInfo5.3.19代码审计思路

 

上传对应的数据包如下

 

MetInfo5.3.19代码审计思路

 

url为/admin/index.php?c=uploadify&m=include&a=doupimg&lang=cn&data_key=undefined

这种url的传参有点像MVC架构的传参方式,url对应的文件为app/system/include/uploadify.class.php,方法名为doupimg()

如果不知道url对应的文件位置,就可以用phpstorm的调试一步步跟进,最后就能跟到对应文件位置

 

MetInfo5.3.19代码审计思路

 

根据返回值来跟踪函数,这个函数返回的是$back,$back又是经过upimg()函数得来,所以继续跟进upimg()

 

MetInfo5.3.19代码审计思路

 

跟进upload()

 

MetInfo5.3.19代码审计思路

 

跟进upfile->upload()

public function upload($form = '') { global $_M; if($form){ foreach($_FILES as $key => $val){ if($form == $key){ $filear = $_FILES[$key]; } } } if(!$filear){ foreach($_FILES as $key => $val){ $filear = $_FILES[$key]; break; } } //是否能正常上传 if(!is_array($filear))$filear['error'] = 4; if($filear['error'] != 0 ){ $errors = array( 0 => $_M['word']['upfileOver4'], 1 => $_M['word']['upfileOver'], 2 => $_M['word']['upfileOver1'], 3 => $_M['word']['upfileOver2'], 4 => $_M['word']['upfileOver3'], 6 => $_M['word']['upfileOver5'], 7 => $_M['word']['upfileOver5'] ); $error_info[]= $errors[$filear['error']] ? $errors[$filear['error']] : $errors[0]; return $this->error($errors[$filear['error']]); } //文件大小是否正确 if ($filear["size"] > $this->maxsize || $filear["size"] > $_M['config']['met_file_maxsize']*1048576) { return $this->error("{$_M['word']['upfileFile']}".$filear["name"]." {$_M['word']['upfileMax']} {$_M['word']['upfileTip1']}"); } //文件后缀是否为合法后缀 $this->getext($filear["name"]); //获取允许的后缀 if (strtolower($this->ext)=='php'||strtolower($this->ext)=='aspx'||strtolower($this->ext)=='asp'||strtolower($this->ext)=='jsp'||strtolower($this->ext)=='js'||strtolower($this->ext)=='asa') { return $this->error($this->ext." {$_M['word']['upfileTip3']}"); } if ($_M['config']['met_file_format']) { if($_M['config']['met_file_format'] != "" && !in_array(strtolower($this->ext), explode('|',strtolower($_M['config']['met_file_format']))) && $filear){ return $this->error($this->ext." {$_M['word']['upfileTip3']}"); } } else { return $this->error($this->ext." {$_M['word']['upfileTip3']}"); } if ($this->format) { if ($this->format != "" && !in_array(strtolower($this->ext), explode('|',strtolower($this->format))) && $filear) { return $this->error($this->ext." {$_M['word']['upfileTip3']}"); } }

检测的关键代码如下

说点什么吧
  • 全部评论(0
    还没有评论,快来抢沙发吧!