PowerShell Remoting for Lateral Movement
You'll learn how attackers use PowerShell's built-in remoting features to execute commands on remote Windows systems during lateral movement.
What is PowerShell Remoting?
PowerShell Remoting is a native Windows feature that allows administrators (and attackers) to run commands on remote machines over the network. Think of it like SSH for Windows, but deeply integrated into the operating system. While designed for legitimate system administration, it's a prime tool for lateral movement because it's often enabled in enterprise environments and blends in with normal administrative traffic.
How It Works for Lateral Movement
Once you've compromised credentials or tokens (through techniques like Pass-the-Hash), you can leverage PowerShell Remoting to execute commands on other machines without physically accessing them.
The Enter-PSSession cmdlet creates an interactive remote session:
Enter-PSSession -ComputerName TARGET-PC -Credential domain\username
This drops you into a PowerShell prompt on the remote system, where you can run commands as if you were logged in locally.
For non-interactive execution, attackers use Invoke-Command:
Invoke-Command -ComputerName TARGET-PC -ScriptBlock { whoami; hostname }
Why Attackers Prefer This
PowerShell Remoting uses Windows Remote Management (WinRM) on ports 5985 (HTTP) or 5986 (HTTPS), which are often allowed through firewalls for legitimate administration. The traffic appears as normal management activity, making detection harder. It also provides full scripting capabilities on remote systems without transferring executables.
Key Takeaway: PowerShell Remoting via Enter-PSSession and Invoke-Command enables seamless lateral movement across Windows networks using legitimate administrative protocols, making it both powerful and stealthy for attackers who've obtained valid credentials.