[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.
- 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:
- Login into my VPS:
ssh ████, password:█████████@ - Execute
nc -nlvp 4446 - cd to
jdbc-sqlite-jolokia-rceand runpython3 poc.py(if running locally, install kafka-python using pip first). - Reverse shell connection should now be established to my test instance
Impact
RCE on the Kafka Connect server
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
- Log in to the attacker's own server over SSH.
- Start a listener for the reverse shell.
- Run the proof-of-concept script from the project directory.
- 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.