MySQL Bulk Data Exfiltration
MySQL data exfiltration ranges from pulling a handful of rows from a high-value table to dumping entire databases. The technique depends on what access is available and how much data needs to be captured. Direct mysqldump produces the cleanest output and handles encoding correctly but generates noticeable query load. Targeted SELECT queries against specific tables are quieter and sufficient when the goal is specific credential or configuration data rather than a full database dump.
Identify High-Value Tables First
Before dumping anything, identify which tables contain credentials, tokens, or sensitive data worth capturing:
Dump a Full Database with mysqldump
mysqldump produces a complete SQL dump including schema and data. Run it from Kali directly against the remote host:
--single-transaction takes a consistent snapshot without locking tables — use this on InnoDB databases to avoid disrupting application operations during the dump.
Dump All Databases
Dump Specific Tables Only
When only specific tables contain the data of interest, dump those individually to reduce output size and query volume:
Export Data to CSV via SELECT INTO OUTFILE
If direct mysqldump is not viable but INTO OUTFILE is available through FILE privilege, export tables to CSV files on the server and then retrieve them:
Then retrieve the file using LOAD_FILE from another session or via shell access:
Extract Targeted Rows with Low Query Footprint
When stealth matters more than completeness, extract only the highest-value rows using targeted queries rather than full table dumps:
Compress Before Transfer
For large dumps, compress locally before moving off the host:
References
-
MySQL — mysqldump documentationdev.mysql.com/doc/refman/8.0/en/mysqldump.html (opens in new tab)
Full flag reference including single-transaction, all-databases, and table filtering
-
MySQL — SELECT INTO OUTFILE referencedev.mysql.com/doc/refman/8.0/en/select-into.html (opens in new tab)
CSV export syntax with field and line terminators
Was this helpful?
Your feedback helps improve this page.