19 December, 2018
netcat lets you receive streams over your network.
I recently had the problem that I wanted to do a MySQL backup but the hosts disk was too full to store it. I only had SSH access and didn't want to make that backup with
MySQL Workbench. So I had to be creative.
Through my pentesting experience I recalled that you can pipe all input output from and to another host. On PentestMonkey there are various examples on how you would achieve a so called "reverse shell". In our case we only want to pipe stdout to another host.
Now this is what I do - I open a netcat session on a host with enough diskspace like so:
nc -lnp 4444 > mysqldump.sql
And on the host where I want to retrieve the backup I'm entering
mysqldump databasename --host=localhost --user=root >& /dev/tcp/remotehost/4444 0>&1
You may need to provide a password
Note, that this transfer is not encrypted whatsoever (And there are usually passwords in database dumps)
Author: Marcel Michelfelder