WinRM

Default Ports: 5985 (HTTP), 5986 (HTTPS)

Windows Remote Management (WinRM) is Microsoft's implementation of the WS-Management protocol, allowing remote management of Windows machines. It's built into Windows and commonly used for remote administration, PowerShell remoting, and system automation. WinRM is the native remote management protocol for Windows and is often preferred over RDP in enterprise environments.

Connect

Using evil-winrm

# Basic connection
evil-winrm -i target.com -u administrator -p 'password'

# With domain
evil-winrm -i target.com -u 'DOMAIN\username' -p 'password'

# Using hash (Pass-the-Hash)
evil-winrm -i target.com -u administrator -H 'NTHASH'

# Using SSL (port 5986)
evil-winrm -i target.com -u administrator -p 'password' -S

# With custom port
evil-winrm -i target.com -u administrator -p 'password' -P 5985

Using PowerShell (from Windows)

Using winrs (Windows Remote Shell)

Using Ruby WinRM Library

Recon

Service Detection with Nmap

Use Nmap to detect WinRM services and identify server capabilities.

Connect to WinRM services to gather version and service information.

Using netcat

Using curl

Using nmap

Configuration Check

Check WinRM configuration and service status.

Enumeration

Use various tools for detailed WinRM enumeration and information gathering.

User Enumeration

Enumerate user accounts to identify potential targets for privilege escalation.

System Information

Gather system information for reconnaissance and privilege escalation.

Network Enumeration

Map internal infrastructure and identify pivot targets.

Process and Service Enumeration

Enumerate processes and services for privilege escalation vectors.

Share Enumeration

Enumerate network shares and file systems.

Attack Vectors

Exploit various WinRM vulnerabilities and misconfigurations for unauthorized access.

Brute Force Attack

Brute force WinRM credentials using various tools and techniques.

Using CrackMapExec

Using Metasploit

Using Custom Script

Pass-the-Hash

Exploit NTLM hash authentication for WinRM access.

Command Execution

Execute commands remotely through WinRM.

Privilege Escalation

Escalate privileges on compromised WinRM systems.

Lateral Movement

Expand access to other systems using WinRM.

Post-Exploitation

Extract sensitive data and establish persistent access after successful WinRM exploitation.

Persistence

Create persistent backdoor access to compromised WinRM systems.

Credential Harvesting

Extract credentials and authentication data from compromised systems.

File Operations

Perform file operations on compromised WinRM systems.

Data Exfiltration

Extract and exfiltrate sensitive data from compromised systems.

Reverse Shell

Establish reverse shell connections for persistent access.

Domain Reconnaissance

Perform Active Directory reconnaissance using WinRM access.

Lateral Movement

Expand access to other systems using WinRM.

Common evil-winrm Commands

Command
Description
Usage

upload

Upload file to target

upload /local/file.exe C:\Windows\Temp\file.exe

download

Download file from target

download C:\file.txt /tmp/file.txt

services

List services

services

menu

Show available commands

menu

Bypass-4MSI

Bypass AMSI

Bypass-4MSI

Invoke-Binary

Execute binary from memory

Invoke-Binary /path/to/binary.exe

PowerShell Remoting Cmdlets

Cmdlet
Description
Example

Enter-PSSession

Interactive remote session

Enter-PSSession -ComputerName target

Exit-PSSession

Exit remote session

Exit-PSSession

Invoke-Command

Run command remotely

Invoke-Command -ComputerName target -ScriptBlock {cmd}

New-PSSession

Create persistent session

$s = New-PSSession -ComputerName target

Remove-PSSession

Close session

Remove-PSSession -Session $s

Get-PSSession

List active sessions

Get-PSSession

Useful Tools

Tool
Description
Primary Use Case

evil-winrm

WinRM shell

Interactive remote shell

crackmapexec

Network attack tool

Authentication and exploitation

Metasploit

Exploitation framework

Various WinRM modules

PowerShell Empire

Post-exploitation

C2 and lateral movement

BloodHound

AD reconnaissance

Domain mapping

Rubeus

Kerberos toolkit

Ticket manipulation

Mimikatz

Credential extractor

Password and hash dumping

PowerView

AD enumeration

Domain reconnaissance

Security Misconfigurations to Test

  • ❌ Weak or default credentials

  • ❌ WinRM enabled on all machines

  • ❌ Unrestricted WinRM access

  • ❌ No certificate validation (HTTP instead of HTTPS)

  • ❌ CredSSP enabled (credential delegation risks)

  • ❌ Unencrypted traffic (port 5985)

  • ❌ Excessive user permissions

  • ❌ No network segmentation

  • ❌ TrustedHosts set to *

  • ❌ No logging or monitoring of WinRM sessions

Last updated