Pivoting, Tunneling, and Port Forwarding
Dynamic Port Forwarding with SSH and SOCKS Tunneling
Local Port Forwarding
# 1234 - attack host port
# 3306 - target host port
ssh -L 1234:localhost:3306 Ubuntu@ip
# Confirm
netstat -antp | grep 1234
# Multiple port forward
ssh -L 1234:localhost:3306 8080:localhost:80 ubuntu@ipDynamic Port Forwarding
# Enabling Dynamic Port Forwarding
# 9050 - attack host port
ssh -D 9050 ubuntu@ip
# Editing proxychains configuration file /etc/proxychains.conf
# We can add socks4 127.0.0.1 9050 to the last line if it is not already there.
# Checking /etc/proxychains.conf
tail -4 /etc/proxychains.conf
# Using Nmap with Proxychains
proxychains nmap -v -sn 172.16.5.1-200 <--ip range which we were not able to scan before, i.e Internal Network
# Using Metasploit with Proxychains
proxychains msfconsole
# Using xfreerdp with Proxychains
proxychains xfreerdp /v:ip /u:eren /p:passRemote/Reverse Port Forwarding with SSH
Meterpreter Tunneling & Port Forwarding
Port Forwarding - portfwd module
Meterpreter Reverse Port Forwarding
Socat
Socat Redirection with a Reverse Shell
Socat Redirection with a Bind Shell
SSH for Windows: plink.exe
Dynamic port forwarding
SSH Pivoting with Sshuttle
Web Server Pivoting with Rpivot
Port Forwarding with Windows Netsh
DNS Tunneling with Dnscat2
SOCKS5 Tunneling with Chisel
Chisel Reverse Pivot
ICMP Tunneling with SOCKS
Last updated