PsExec is a very versatile tool that is part of the SysInternals suite developed by Mark Russinovich. It’s intended to replace telnet-like applications and provide remote execution of processes on other systems through an interactive console.

It is possible to misuse this tool for lateral movement, but three requisites must be met.
First, the user that authenticates to the target machine needs to be part of the Administrators local group.
Second, the ADMIN$ share must be available.
Third, File and Printer Sharing has to be turned on.

Luckily for us, the last two requirements are usually met as they are the default settings on modern Windows Server systems.

PsExec performs the following tasks:

  • Writes psexesvc.exe into the C:\Windows directory
  • Creates and spawns a service on the remote host
  • Runs the requested program/command as a child process of psexesvc.exe

Here’s a basic command - .\PsExec64.exe -i \\FILES04 -u corp\jen -p Nexus123! cmd. You can also run it like this .\PsExec64.exe -i '\\192.168.139.72' -u 'corp\jen' -p 'Nexus123!' powershell.