Reverse shell on firewalled server

Sometimes, it may be useful to keep a connection to a server (let’s call it SERVER_1) that is not reachable from the internet because of iptables ingress rules or simply because it doesn’t have a public IP.  You can reach it from another server (let’s name it SERVER_2) that is accessible.

1 – From the server you want to reach (SERVER_1) :

you@SERVER_1:/~ ssh -R 22222:localhost:22 USERNAME@SERVER_2

2 – Connect to SERVER_2

you@mypc:/~ ssh USERNAME@SERVER_2

3 –  Execute :

you@SERVER_1:/~ ssh -p 22222 localhost
you@SERVER_2:/~

RevShell

That’s it, you’re now connecte to SERVER_1 using your reverse Shell !

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *