Is port 5985 (WinRM) exposed to the internet?
AdminKit's short answer: if TCP port 5985 or 5986 on your public IP accepts a connection, Windows Remote Management is offering remote PowerShell to anyone online, and every valid administrator password becomes a way in. WinRM is safe on an internal management network. Restrict it by firewall to admin hosts and use JEA.
By AdminKit team, Netbase JSC · Updated
Key takeaways
- TCP 5985 (HTTP) and 5986 (HTTPS) are the default ports of Windows Remote Management, the service behind PowerShell Remoting and other Windows management tools.
- WinRM encrypts PowerShell Remoting traffic after login even over HTTP, unless Basic authentication is used. Encryption is not the problem with exposing it; a remote administrator shell protected only by a password is.
- WinRM’s login options range from Kerberos, which proves both sides, to NTLM, which cannot prove the server, to Basic, which sends the password in clear text.
- AdminKit’s port check does not test 5985 or 5986. Test them by hand from outside, against your own IP only, then limit WinRM to admin hosts by firewall and give operators only the commands they need with JEA.
What is listening on ports 5985 and 5986?
Windows Remote Management is Microsoft’s implementation of WS-Management, the Web Services for Management protocol. Microsoft’s page on security considerations for PowerShell Remoting using WinRM calls PowerShell Remoting the recommended way to manage Windows systems, says it is enabled by default in Windows Server 2012 R2 and later, and lists its ports as 5985 for HTTP and 5986 for HTTPS. The IANA registry records the same pair as wsman and wsmans.
The WinRM installation and configuration guide adds the details that matter for exposure. No listener exists until one is configured, but winrm quickconfig creates a listener that accepts requests on any IP address and adds a firewall exception. The listener’s address filters default to every IPv4 and IPv6 address. Optional compatibility listeners can also answer on ports 80 and 443; they are off by default, and Microsoft’s HTTPS article notes that Windows versions before Windows 7 used 80 and 443 for WinRM instead of 5985 and 5986.
| Where WinRM runs | Typical use | Why it matters if reachable from outside |
|---|---|---|
| Windows Server | PowerShell Remoting, Server Manager, configuration tools | Remote administrator shell on the server |
| Domain controller | Remote administration of the directory | An administrator session here controls the domain |
| Cloud VM with a public IP | Automation and configuration management | Reachable from wherever its inbound rules allow |
| Workstation with remoting turned on | Help desk scripts, software deployment | Local accounts log in with NTLM, which cannot prove the server |
| Appliance or BMC with a WS-Management listener | Hardware management | The same port number on a different, embedded stack |
How does WinRM decide who gets in?
A WinRM connection has two security questions: how the client and server prove who they are, and how the traffic is protected afterwards. Microsoft’s page on authentication for remote connections and the configuration guide list the methods and their defaults:
| Method | What it does | Default on the WinRM service |
|---|---|---|
| Kerberos | Client and server authenticate each other; both must be domain members, and the client must use a name, not an IP address | Enabled |
| Negotiate | Picks Kerberos for domain accounts and NTLM for local accounts or workgroups | Enabled |
| Basic | Sends the user name and password in clear text; Microsoft calls it the least secure method | Disabled |
| Client certificate | Maps a client certificate to a local account | Disabled |
| CredSSP | Delegates the user’s credentials to the server so it can reach other systems | Disabled |
| Digest | Challenge-response scheme | Not accepted by the WinRM service |
Microsoft’s security page explains the trade-offs. Kerberos guarantees both the user’s and the server’s identity without sending a reusable credential. NTLM, used when the client connects by IP address or to a workgroup server, proves the user without sending the password, but cannot guarantee the server’s identity. An HTTPS certificate from a trusted authority fixes that gap. The alternative, adding the server to the client’s TrustedHosts list, only suppresses the error; Microsoft says it should not be read as any statement that the host is trustworthy.
By default, PowerShell Remoting accepts connections only from members of the Administrators group. That sounds restrictive, but on an exposed port it means every successful login is an administrator login.
Does HTTP on port 5985 mean the traffic is unencrypted?
Usually not, and that surprises people. Microsoft states that regardless of the transport, HTTP or HTTPS, WinRM always encrypts PowerShell Remoting communication after initial authentication. Over HTTPS the protection comes from TLS. Over HTTP it comes from message-level encryption negotiated by the authentication method: Kerberos uses the ticket’s encryption type, with AES-256 on modern systems, NTLM uses RC4 with a 128-bit key, and CredSSP uses the TLS cipher suite from its own handshake.
The exception is Basic authentication, which provides no encryption at all. The WinRM service also has an AllowUnencrypted setting, off by default, that would let clients request unencrypted traffic. If either has been switched on to make a script work, port 5985 really is carrying passwords and commands in the clear. Microsoft’s article on configuring WinRM for HTTPS says the HTTPS listener needs a Server Authentication certificate whose CN matches the host name, and that it must not be expired, revoked or self-signed; our glossary entry on X.509 certificates covers what those fields mean.
Why shouldn’t WinRM face the internet?
Because it is a front door for administrators, and attackers know it. MITRE ATT&CK’s entry for Windows Remote Management (T1021.006) describes adversaries using valid accounts to interact with remote systems over WinRM, running executables, changing the registry and modifying services as the logged-on user. A reachable listener lets anyone try passwords for administrator accounts, and stolen or reused credentials work the same way from anywhere in the world.
Microsoft’s own defaults point the same way. Its security page says that on private networks the default Windows Firewall rule for PowerShell Remoting accepts all connections, while on public networks it only allows connections from within the same subnet. You have to change that rule explicitly to open remoting to everyone on a public network, and Microsoft warns that the public rule exists to protect the computer from malicious outside connection attempts.
How does WinRM end up reachable from the internet?
These are the usual paths:
- A cloud VM with a broad security group. An inbound rule for 5985 or 5986 from anywhere was added so a deployment tool could connect, and nobody narrowed it.
- A server on a network marked private or domain. The firewall rule for those profiles accepts all connections, and the edge firewall forwards the port.
- A port forward for remote administration. Someone forwards 5985 so they can run PowerShell from home instead of setting up a VPN.
- A changed public-profile rule. The subnet restriction on the public firewall rule was removed to fix a connection problem.
How do you read AdminKit’s port check for ports 5985 and 5986?
AdminKit’s open ports check tests the public IP you are browsing from, using TCP connections to a fixed list: 23, 554, 1883, 8883, 502, 7547, 80, 443 and 8080. It lists BACnet/IP (47808) and CoAP (5683) as not scanned, because they run over UDP. Ports 5985 and 5986 are not on that list, so the check says nothing about WinRM either way. Confirm which address you are testing with what is my IP first.
| What the result shows | What it tells you about WinRM |
|---|---|
| “0/9 TCP port(s) open” with an OK status | Only the nine listed TCP ports were tested. 5985 and 5986 may still be reachable |
| 80 or 443 open | A web server answers. On older systems, or with compatibility listeners on, WinRM can use these ports; test 5985 and 5986 as well |
Our guide on how to read an open ports scan result explains each tile and status.
How do you confirm ports 5985 and 5986 from outside?
Use a machine outside your network, such as a laptop on a mobile hotspot, and test only your own public address. A TCP connection test shows the exposure without logging in (a documentation address is shown):
nc -vz -w 3 203.0.113.40 5985
nc -vz -w 3 203.0.113.40 5986
On Windows, PowerShell does the same check:
Test-NetConnection 203.0.113.40 -Port 5985
A “succeeded” result, or TcpTestSucceeded : True, means the port accepted a connection from the internet. Do not try to log in with real or guessed credentials as a test; a successful connection is enough to justify the fix.
How do you check the WinRM configuration on the server?
On the Windows host, list the listeners and the service’s authentication settings from an elevated prompt:
winrm enumerate winrm/config/listener
winrm get winrm/config/service
The first shows each listener’s transport, port and addresses. The second shows whether Basic, CredSSP, certificate authentication or AllowUnencrypted have been turned on. Then check which firewall rules allow WinRM in, and from where:
Get-NetFirewallRule -DisplayGroup "Windows Remote Management" |
Get-NetFirewallAddressFilter
A remote address of Any on an enabled rule, combined with an open path through the edge firewall, is the exposure.
How do you fix an exposed WinRM port?
Close the public path first, then reduce what WinRM can do:
- Remove the public path. Delete the port forward or cloud security group rule for 5985 and 5986, and re-run the outside test.
- Restrict WinRM by host firewall. Scope the Windows Firewall rules to the management subnet or jump hosts that need them. MITRE recommends host firewalls that allow WinRM only to and from specific devices, and separate WinRM infrastructure and accounts for critical systems.
- Reach servers through a VPN or jump host, not over the internet, and connect by name inside the domain so Kerberos, not NTLM, authenticates both sides.
- Keep Basic and AllowUnencrypted off. Use HTTPS on 5986 with a proper certificate wherever Kerberos is not available.
- Use Just Enough Administration. Microsoft’s JEA overview describes endpoints that limit users to specific cmdlets, functions and external commands, run privileged actions through virtual or group-managed service accounts so fewer people need administrator rights, and record transcripts of what each user ran.
- Disable WinRM where nobody uses it. MITRE’s first mitigation is to disable the WinRM service on systems that do not need it.
Which related ports should you check?
Windows servers that expose WinRM often expose other management ports too. See is port 3389 (RDP) exposed for remote desktop and is port 445 (SMB) exposed for file sharing. Server hardware can also answer on the same port number: HD Moore’s penetration tester’s guide to IPMI and BMCs on the Rapid7 blog shows a server management controller with a WS-Management listener on 5985, and is port 623 (IPMI) exposed covers those controllers. Browse the security basics cluster for related checks.
Which networks may you test?
Every check this page links to is for assets you own or are explicitly authorized to test. Never scan, probe, or attempt to connect to a network or device you don’t control. AdminKit’s active checks only ever run against the IP making the request or an asset you’ve verified ownership of. See our Disclaimer and Acceptable Use Policy for the full terms.
This guide is general information, not a security audit of your specific network — see our disclaimer for what AdminKit's guidance does and does not commit to.
Frequently asked questions
What are ports 5985 and 5986 used for?
They are the default ports of Windows Remote Management (WinRM), Microsoft's implementation of the WS-Management protocol: 5985 for HTTP and 5986 for HTTPS. PowerShell Remoting runs over WinRM, so these ports carry remote PowerShell sessions as well as other management tools. IANA registers them as wsman and wsmans.
Is WinRM over HTTP on port 5985 unencrypted?
Not usually. Microsoft states that WinRM always encrypts PowerShell Remoting traffic after initial authentication, using message-level encryption from Kerberos, NTLM or CredSSP when the transport is HTTP. Basic authentication is the exception: it provides no encryption and sends the user name and password in clear text, which is why it is off by default on the WinRM service.
Which authentication methods does WinRM support?
Kerberos, Negotiate (Kerberos or NTLM), Basic, client certificates and CredSSP. On the WinRM service, Kerberos and Negotiate are enabled by default, and Basic, certificate and CredSSP authentication are disabled. Kerberos is used for domain computers addressed by name; NTLM is used for workgroup computers or when a client connects by IP address.
Does AdminKit's port check test ports 5985 and 5986?
No. The port check tests a fixed list of nine TCP ports (23, 554, 1883, 8883, 502, 7547, 80, 443, 8080) on the public IP you connect from, and lists two UDP ports as not scanned. Ports 5985 and 5986 are not on that list, so a clean result says nothing about WinRM. Test them manually from outside your network.
Is HTTPS on port 5986 safe to expose to the internet?
No. HTTPS proves the server's identity and encrypts the channel, but anyone online can still try passwords against the listener, and a valid administrator credential then gives a full remote shell. MITRE ATT&CK lists WinRM as a remote service attackers use with valid accounts, and recommends host firewalls that allow it only to and from specific devices.
Sources
- Microsoft Learn — Installation and configuration for Windows Remote Management
- Microsoft Learn — Security considerations for PowerShell Remoting using WinRM
- Microsoft Learn — Authentication for remote connections (WinRM)
- Microsoft Learn — How to configure WinRM for HTTPS
- Microsoft Learn — Just Enough Administration (JEA) overview
- MITRE ATT&CK — Remote Services: Windows Remote Management (T1021.006)
- Rapid7 — A Penetration Tester's Guide to IPMI and BMCs (HD Moore)
- IANA — Service Name and Transport Protocol Port Number Registry
Want AdminKit to watch this for you?
Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.
Talk to an expert
Huy Nguyen (David), Founder & CEO, Netbase JSC
Ask whether this fix applies to your setup, or get a second pair of eyes on your DNS and mail records.