Skip to content
RCE Disclosed report Advanced

[Kafka Connect] [JdbcSinkConnector][HttpSinkConnector] RCE by leveraging file upload via SQLite JDBC driver and SSRF to internal Jolokia

The JDBC sink connector bundled the SQLite JDBC driver, which let an attacker upload a crafted SQLite database file to the server, and the HTTP sink connector could reach an unprotected Jolokia endpoint on localhost. By loading the uploaded database as a JVM agent through a JMX diagnostic operation, the attacker could run code on the Kafka Connect server.

jarij Follow

Originally disclosed on HackerOne

Bounty$5,000 Critical View original
  • Triaged in 18 days
  • Fixed in 32 days
  • Paid in 32 days
  • Disclosed after 7 months

Summary:

The Aiven JDBC sink includes the SQLite JDBC Driver. This JDBC driver can be used to upload SQLite database files onto the server. The HTTP sink connector allows sending HTTP requests to localhost. There is unprotected Jolokia listening on localhost:6725. JMX exports the com.sun.management:type=DiagnosticCommand MBean, which contains the jvmtiAgentLoad operation. This operation can be used to execute the SQLite database as JVM Agent by embedding the JVM Agent JAR file inside the SQLite database as an BLOB field in a table.

Steps To Reproduce:

2022-04-22_15-14-04.mp4 From the original on HackerOne
  1. Login into my VPS: ssh ████, password: █████████@
  2. Execute nc -nlvp 4446
  3. cd to jdbc-sqlite-jolokia-rce and run python3 poc.py (if running locally, install kafka-python using pip first).
  4. Reverse shell connection should now be established to my test instance

Impact

RCE on the Kafka Connect server

The original report as published on HackerOne, by jarij. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the combination of a file-writing JDBC driver, an HTTP connector able to reach localhost, and an unauthenticated Jolokia JMX endpoint exposing a diagnostic operation that loads JVM agents.

Impact

An attacker could achieve remote code execution on the Kafka Connect server.

What the attacker needed

HTTP sink connector able to reach localhost; unprotected Jolokia on localhost:6725

How it was found

  1. Log in to the attacker's own server over SSH.
  2. Start a listener for the reverse shell.
  3. Run the proof-of-concept script from the project directory.
  4. Observe the reverse shell connection to the test instance.

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 report has not been written yet. The Original tab links to the source.

Kafka Connect is a tool that moves data between systems using connectors. One connector could write files to the server, and another could make requests to services only reachable from inside the machine, including a management interface that could load code. Combining these let an attacker run their own programs on the server.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by jarij

View all

4 more disclosed reports, best first.

More from Aiven Ltd

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.