3 ways to get Remote Code Execution in Kafka UI
Kafka UI allowed remote code execution through three different vectors: Groovy script injection in message filters, JMX deserialization via a malicious Kafka broker, and JNDI injection through SASL JAAS configuration. An attacker could execute arbitrary commands on the server, potentially leading to full system compromise.
Published on github.blog
Michael Stepankin·@artsploit
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the application failed to properly sanitise user input in features that evaluate code or deserialise data, such as Groovy scripts, JMX connections, and JNDI lookups.
Impact
An attacker could execute arbitrary commands on the Kafka UI server, potentially leading to full system compromise, and the Groovy script RCE could be triggered via a CSRF-style attack.
What the attacker needed
Kafka UI instance accessible; For Groovy: at least one topic with messages; For JMX: dynamic.config.enabled=true; For JNDI: dynamic.config.enabled=true
The fix
The vulnerabilities were fixed in version 0.7.2 by updating dependencies and restricting dangerous features.
How it was found
- Navigate to a cluster, select a topic, and click the 'Messages' tab.
- Create a new filter with a Groovy script that spawns a reverse shell.
- Submit the filter, which sends a GET request to the server with the script.
- For JMX: enable dynamic.config.enabled, then add a new cluster with a malicious JMX port.
- For JNDI: send a PUT request to /api/config/validated with a malicious SASL JAAS configuration.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Kafka UI is a web tool for managing Kafka, a system for handling data streams. The report shows that attackers could trick Kafka UI into running harmful code by abusing features like message filters and cluster settings. This means someone could take control of the server running Kafka UI.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.