
Setting up secure connectivity
It is not only important to ensure that there is connectivity from the local on-premises box to the C&C server; however, it should also be secure. You don't want to give someone the ability to sniff the traffic and get information that they shouldn't have. This not only makes you look bad as a penetration tester, but could also cause serious issues for the company you are running the penetration test for.
Your job as a penetration tester is to find weaknesses in the environment. So having these being clearly seen in as they pass over the wire is like forgetting to close your safe, where you have all of your most important and valuable items.
For my penetration-testing requirements, I will use a reverse SSH tunnel within a stunnel instance. I will show you the steps to set up this secure communication from the C&C server side to the on-premises box, which in my case is the Raspberry Pi. First, we will start inside in with the reverse SSH setup, followed by the stunnel setup. But when bringing up the connection, this happens in the opposite order, with the stunnel session getting set up first, followed by the reverse SSH session within that tunnel.