Transferring files to/from remote victim
Once we compromised a system we could use different methods to transfer files to/from the victim depending on the situation.
Using wget or cURL
If the compromised victim has privileges enough to download files we could use wget or curl to copy a file from our own machine. First go into the directory that contains the file you want to transfer and run a simple Python HTTP server there with:
Now the server is listening on 8080 in our machine, download the file on the "compromised with code execution" victim with:
Also could be vice-versa with the http server in the victim(if it has python installed) and the attacker downloading via wget/curl.
Using SSH file transfer SCP
Granted we obtained SSH credentials we could use SCP to transfer files from our attacking machine to the victim directly:
Using Base64
If you are not able to transfer files directly, for example because the firewall protection prevents the victim to download files, you could use the base64 trick.
Consists on encoding the file in base64 without line breaks (-w 0
) so you can copy every detail from the file:
And paste the result on the compromised machine with:
To validate that the file transferred correctly we could check and compare the MD5 hash from the original file to the file pasted in the victim system:
Last updated