SSH Pivoting using Meterpreter

If you are aware of SSH tunneling then you can easily understand SSH pivoting, if not then don’t worry read SSH tunneling from here.   

Pivoting is technique to get inside an unreachable network with help of pivot (centre point). In simple words it is an attack through which attacker can exploit those system which belongs to different network. For this attack, the attacker needs to exploit the main server that helps the attacker to add himself inside its local network and then attacker will able to target the client system for attack.


This module will test ssh logins on a range of machines and report successful logins. If you have loaded a database plugin and connected to a database this module will record successful logins and hosts so you can track your access.

From given image you we can observe that command shell session 1 opened

Now convert command shell into meterpreter shell through following command

From given image you can observe that Meterpreter session 2 opened

 Hence if you will count then currently attacker has hold 2 sessions, 1st for command shell and 2nd for meterpreter shell of SSH server.

Check network interface using ifconfig command

From given image you can observe two network interface in victim’s system 1st for IP through which attacker is connected and 2nd for IP through which SSH client (targets) is connected.

Since attacker belongs to interface and client belongs to interface therefore it is not possible to directly make attack on client network until unless the attacker acquires same network connection. In order to achieve network attacker need run the post exploitation “autoroute”.

This module manages session routing via an existing Meterpreter session. It enables other modules to ‘pivot’ through a compromised host when connecting to the named NETWORK and SUBMASK. Autoadd will search a session for valid subnets from the routing table and interface list then add routes to them. Default will add a default route so that all TCP/IP traffic not specified in the MSF routing table will be routed through the session when pivoting.

This time we are exploiting SSH ignite (local client) therefore we are going to use same module for it that had used above for SSH raj, only need to change information inside exploit.

 From given image you can see another command shell 3 opened, if you will count then total attack has hold 3 sessions, two for SSH server and one for SSH client.


  1. Command shell for SSH raj (
  2. Meterpreter shell for SSH raj (
  3. Command shell for SSH ignite (

Sessions 3

Now attacker is command shell of SSH ignite (client), let’s verify through network configuration.


From given you can observe the network IP is

 Pivoting is Dangerous but enjoyable network attack 

Author: AArti Singh is a Researcher and Technical Writer at Hacking Articles an Information Security Consultant Social Media Lover and Gadgets. Contact here

Leave a Reply

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