Kafka UI is an open-source web interface for managing and monitoring Apache Kafka clusters. One of its core features is the ability to connect to different Kafka brokers using their network address and port. Additionally, it offers monitoring capabilities by connecting to Kafka brokers' JMX (Java Management Extensions) ports. However, it has been discovered that certain deployment configurations of Kafka UI are vulnerable to potential remote code execution attacks due to JMX deserialization vulnerabilities. This blog post will provide details about the vulnerability, exploit methods, and how to address the issue.

The vulnerability affects deployments where one of the following conditions is met

1. The dynamic.config.enabled property is set to true in the configuration settings. This property is not enabled by default, but many online tutorials and Kafka UI's README.md file suggest enabling it.

2. An attacker has access to the Kafka cluster connected to Kafka UI. In this situation, an attacker can exploit the vulnerability to expand their access and execute arbitrary code on the Kafka UI server.

The issue arises from JMX's reliance on the RMI (Remote Method Invocation) protocol, which is susceptible to deserialization attacks. A skilled attacker could set up a malicious RMI listener instead of a legitimate JMX port, which would return a malicious serialized object for any RMI call. This could result in remote code execution, as Kafka UI has the required gadget chains in its classpath. The vulnerability is especially dangerous because Kafka UI does not have authentication enabled by default, potentially allowing unauthorized users to exploit the issue.

The vulnerability has been assigned the identifier CVE-2024-32030 and is also tracked as GHSL-2023-230 by the GitHub Security lab which discovered and reported the issue.

Exploit

A possible exploit scenario involves an attacker who has access to the Kafka cluster connected to Kafka UI. The attacker could execute the following steps:

Set up a malicious RMI listener, which returns a malicious serialized object for any RMI call.

2. Modify the Kafka UI configuration to connect to the malicious RMI listener, instead of a legitimate JMX port.

3. Monitor the Kafka UI server for requests to the malicious RMI listener, which would result in the deserialization of malicious objects and potentially lead to remote code execution on the Kafka UI server.

Mitigation

This issue has been addressed in Kafka UI version .7.2. All users are strongly encouraged to upgrade their Kafka UI deployment to this version or a more recent release. Currently, there are no known workarounds for this vulnerability.

Original References

1. GitHub Security Lab Report
2. Kafka UI .7.2 Release Notes
3. Kafka UI README.md

Closing Remarks

The potential remote code execution vulnerability in Kafka UI highlights the importance of always staying up-to-date with the latest software releases and patches. It also serves as a reminder to carefully review configuration settings and the security implications of enabling or disabling various features, especially in environments with limited authentication. As always, security should be a primary concern for all technology stakeholders, and vulnerabilities such as the one described in this post should be addressed promptly to protect valuable data and infrastructure.

Timeline

Published on: 06/19/2024 17:15:57 UTC
Last modified on: 08/02/2024 01:59:50 UTC