Auditing JDBC Drivers at Scale with AI led to 85000 bounty
The Databricks JDBC driver let the connection-string property StagingAllowedLocalPaths be supplied by the user, so the allowlist meant to restrict local file staging could be set to any path, giving arbitrary local file read and write. Chained with a Git repository clone feature, overwriting the cloned repo's config file turned this into remote code execution; a similar file read existed in the Exasol driver.
hacktron.ai
Published on hacktron.ai
A few months back, a friend of mine, @sudhanshur705, was participating in a bug bounty event. He mentioned that his target scope relied heavily on JDBC drivers and asked if I wanted to collaborate and dig into the drivers used on the platform, with the hope of finding an RCE or an impactful server-side vulnerability.
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 driver trusted a security-relevant allowlist that was supplied by the same user it was meant to constrain, so the restriction could be set to any path.
Impact
An attacker could read and write arbitrary files on the client system and, by chaining with the Git clone feature, achieve remote code execution, though the local user's limited write permissions constrained the file writes.
What the attacker needed
Control of the JDBC connection string; ability to run a PUT query; access to a Git clone feature
The fix
Databricks added a documentation note warning that letting users control StagingAllowedLocalPaths can lead to security issues.
How it was found
- Enumerate the file-related sinks in the decompiled driver and trace which take dynamic input.
- Identify the StagingAllowedLocalPaths connection-string property and note the user supplies the allowlist.
- Use a PUT query to upload a local file to a Databricks volume.
- Use the reverse direction to download a server file to an attacker-chosen local path.
- Overwrite the .git/config of a cloned repository with a controlled sshCommand pointing to a remote SSH URL.
- Trigger a Git operation such as creating a branch to execute the command.
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.
A JDBC driver is a piece of software that lets a program talk to a database. This driver had a setting meant to limit which folders on the user's own computer could be used for staging files, but the user themselves chose that list, so the limit did nothing. By abusing it, someone could read or write files on the machine running the driver, and by also abusing a Git clone feature they could run their own commands.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.