PowerShell Remoting

PowerShell Remoting

circle-info

Requires Administrative access and target to have WinRM on port 5985 / 5986 to be open

  • One-to-One

  • Interactive

  • Stateful

  • Executes in a new process (wsmprovhost)

  • Execute command on multiple systems at once

  • Runs background jobs

  • -Credential parameter can be used to pass credentials

#Enable PowerShell Remoting on local system (Requires elevated privileges)
Enable-PSRemoting

# Create new PSSession
New-PSSession -Computer Srv01.Security.local

# Connect to PSSession
Enter-PSSession -Computer Srv01.Security.local

# Store session as variable
$Session = New-PSSession -Computer Srv01.Security.local

If you have sessions stored as variables then commands with the -Computername parameter can be replaced with -Session $session.

Multiple Systems

Disabling Defenses

WMIC

Executing calc.exe on remote system

Executing reverse shell on remote system from a SMB share hosted on attackers system

Setting up persistence with schtasks on a remote system to execute a reverse shell every minute/

Last updated