Abusing MYSQL CLients
A web page that let users connect to an arbitrary MySQL server was vulnerable because the MySQL client supports LOAD DATA LOCAL INFILE, which makes the client read a file from its own machine and send it to the server. An attacker running a fake MySQL server could therefore read files from the web server.
Published on vesiluoma.com
Thinking to expose your service that fetches content from some user given MySQL server? Think again.
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
The MySQL client honours a server request to read a local file (LOAD DATA LOCAL INFILE) without restricting which files can be read or requiring user consent.
Impact
An attacker could read files from the machine running the MySQL client, such as the web server, leading to local file inclusion.
What the attacker needed
Victim connects to attacker-controlled MySQL server; client supports LOAD DATA LOCAL
The fix
The LOAD DATA LOCAL feature should be disabled on the client, or the client should not allow arbitrary file reads.
How it was found
- Set up a fake MySQL server that sends a greeting and accepts any authentication.
- Send a LOAD DATA LOCAL INFILE request for a file such as /etc/hosts.
- Receive the file contents from the connecting client.
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.
MySQL is a database program. Normally the database server sends data to the client program that connects to it. But MySQL has a feature where the client can be told to read a file from its own computer and send it to the server. If an attacker controls the server, they can ask the client to send any file the client can read, such as system files.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.