一、前提了解
1.分析
以往的单纯SQL注入获取MySql数据库表名、列名等,均基于其information_schema库获取,若后台开发者使用非MySql数据库或屏蔽information_schema,则无法获取数据库表名、列表等信息。
2.解决
此时,需要Burp suite结合SQL注入进行暴力破解获取数据库表名、列表等信息。
3.知识点
3.1 正常sql语句:select name,password from users where id='id名';
3.2 升级版sql语句(id名为不存在的id):select name,password from users where id='id名' or exists(select * from 表名);
释1:exists内的select * from 表名结果存在,exists为真,where后组体为真,不进行where筛选,返回所有查到的结果,反之则假报错表名不存在。
释2:若id名为正确存在的id,or需要换为and。
二、构建sql语句并测试:
1.根据知识点3.2构建payLoad:
1.1 users表存在:
payLoad1=' or exists(select * from users)#
1.2 abc表不存在:
payLoad2=' or exists(select * from abc)#
2.sql注入测试:
2.1 user表存在时(可忽略存在测试):
2.1 abc表不存在时:
三、结合Burp suite进行暴力破解:
1.点击Burp suite查看如何利用其进行攻击
2.其中,变量只有一个——表名abc,攻击方式推荐为Sniper
3.结果抓取为doesn’t exist
四、结果分析:
未抓取到报错信息的,即为存在的表名,列名同理。