SSH for Windows: plink
Imagine that we are on a pentest and gain access to a Windows machine. We quickly enumerate the host and its security posture and determine that it is moderately locked down. We need to use this host as a pivot point, but it is unlikely that we will be able to pull our own tools onto the host without being exposed. Instead, we can live off the land and use what is already there. If the host is older and PuTTY is present (or we can find a copy on a file share), Plink can be our path to victory. We can use it to create our pivot and potentially avoid detection a little longer.
The Windows attack host starts a plink.exe process with the below command-line arguments to start a dynamic port forward over the Ubuntu server. This starts an SSH session between the Windows attack host and the Ubuntu server, and then plink starts listening on port 9050.
Another Windows-based tool called Proxifier can be used to start a SOCKS tunnel via the SSH session we created.
After configuring the SOCKS server for 127.0.0.1
and port 9050, we can directly start mstsc.exe
to start an RDP session with a Windows target that allows RDP connections.