Nanobyte Security | Pivoting Basics - Part 1

Pivoting Basics - Part 1

[ HTB  OSCP  Pivoting  ]

Part 1, pivoting introduction and using SSHuttle
Part 2, pivoting with Chisel
Part 3, pivoting with Ligolo-ng
Pivoting Cheat Sheet, pivoting cheat sheet

Pivoting!? - Part 1

What the heck is pivoting? In short, it is a technique that is used after a foothold is gained on a target machine, and you wish to access a network that is otherwise not publically accessible, such as from a second internal network interface. For an example, let’s consider the following. Let’s imagine you have a web server, call it WEB01, with a public IP of, which you have compromised and have access to. If you wish to pivot to an internal network,, pivoting on the WEB01 box would provide you access to the internal, which you could then access on your Kali Linux machine.

For the following scenario, and for the rest of my walkthroughs, the following will remain true:

  • Kali Linux (Attacking Machine):
  • First Pivot Machine (Public IP):
  • First Network:
  • Second Network:
  • Second Pivot Machine:
  • Third Network:
  • Third Pivot Machine:

To begin this tutorial, we have the ability to login to WEB01 with SSH credentials, using an id_rsa file. It can be a user, or admin/root, it does not matter. For Part 1, we wish to access DC01, located at



To start, imagine you want to pivot from WEB01, out the interface, to enumerate DC01 on As most HTB machines use SSH on their first foothold, I will assume a SSH id_rsa key is already discovered and available. The easiest tool, and my goto, is SSHuttle. It is baked into Kali Linux, but if you are not using Kali, it can be installed easily. Here is the GitHub for SShuttle.

sshuttle -r <username>@<ip_addr> <remote_network> -e 'ssh -i id_rsa_file'

The above command expects two parameters, -r and -e:

  • -r : (also –remote) is the remote network you want to access
  • -e : (also –ssh-cmd) is the ssh command to run. In this case, because we have an id_rsa file of the victim user, we use the basic ssh’s -i flag

Our command would thus look like:

sshuttle -r root@ -e 'ssh -i id_rsa.txt'

If all is correct, we will receive ‘c : Connected to Server’:


We would now have access to the first subnet,, and also where DC01’s interface resides. We could now continue with enumeration of the new network. Our network diagram would appear like:


And as a bonus, if we wisht to begin enumerating, with NMAP, we could use the following command:

nmap -Pn

However, because we are going through a tunnel, we would not be able to use the full suite of scans available from NMAP, such as NSE.

[ HTB  OSCP  Pivoting  ]