Pivoting, Tunneling & Port Forwarding
Terminology
Definitions
NICs
ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 4a:8c:db:a0:71:e0 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 177 overruns 0 carrier 0 collisions 0
enp0s31f6: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether c4:ef:bb:88:4b:91 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 19 memory 0x9c300000-9c320000
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 8641 bytes 709838 (709.8 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8641 bytes 709838 (709.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vmnet1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.168.1 netmask 255.255.255.0 broadcast 192.168.168.255
inet6 fe80::250:56ff:fec0:1 prefixlen 64 scopeid 0x20<link>
ether 00:50:56:c0:00:01 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 414 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vmnet8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.27.1 netmask 255.255.255.0 broadcast 192.168.27.255
inet6 fe80::250:56ff:fec0:8 prefixlen 64 scopeid 0x20<link>
ether 00:50:56:c0:00:08 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 420 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vmnet10: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.16.16.1 netmask 255.255.255.0 broadcast 172.16.16.255
inet6 fe80::250:56ff:fec0:a prefixlen 64 scopeid 0x20<link>
ether 00:50:56:c0:00:0a txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 412 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp0s20f3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.23 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::7b26:7eec:531c:6fe8 prefixlen 64 scopeid 0x20<link>
ether c4:47:4e:f8:b7:c2 txqueuelen 1000 (Ethernet)
RX packets 48522 bytes 43286033 (43.2 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 36191 bytes 7787538 (7.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0Routing
Local Port Forwarding
SSH Local Port Forwarding
Meterpreter Port Forwarding module
Dynamic Port Forwarding
Using SSH and SOCKS tunneling
Setting up the Pivot: A Data Tunnel from Attacker to Internal Network
Step 1: Dynamic Port Forwarding with SSH
Step 2: SOCKS Tunneling
Step 3: Nmap + Proxychains
Using Meterpreter Port Forwarding Module
Remote/Reverse Port Forwarding
Preparing and Transferring the Reverse Shell
Establishing the connection: Internal network - Attack host
Socat: Redireting Traffic between two channels
Socat -Reverse Shell
Socat - Bind Shell
Rpivot: Accessing an Internal Web Server
Netsh: Pivoting from a Windows Host
DNScat2: Encrypting our traffic
Chisel: Creating a two-way tunnel
Chisel "forward" Pivot
Chisel Reverse Pivot
Last updated