Home
What TCP Port 5357 Does on Windows and How to Secure It
TCP port 5357 is a network port primarily utilized by the Microsoft Web Services for Devices API (WSDAPI). In a standard Windows environment ranging from Windows Vista to Windows 11 and various Windows Server editions, this port facilitates the seamless discovery and communication between your computer and network-connected hardware like printers and scanners. It operates using the Hypertext Transfer Protocol (HTTP) and is a critical component of the "Plug and Play" experience for modern networked peripherals.
If you have performed a network scan using tools like Nmap or checked active connections on your machine with netstat, seeing port 5357 in a "LISTENING" state is entirely normal for a Windows host. However, understanding its underlying mechanism, its relationship with other ports, and its security implications is essential for system administrators and security-conscious users alike.
The Architecture of WSDAPI and Port 5357
To understand why port 5357 exists, one must look at the evolution of device connectivity in Windows. Historically, network devices relied on protocols like SNMP (Simple Network Management Protocol) or NetBIOS for discovery. These protocols often required complex configurations or specific drivers to function correctly across different subnets.
Microsoft introduced WSDAPI to implement the Devices Profile for Web Services (DPWS). DPWS is essentially a set of constraints on Web Service standards—such as WSDL, XML Schema, SOAP, and WS-Discovery—designed to allow resource-constrained devices to be managed over a network.
The Role of HTTP on Port 5357
When a device is discovered on the network, the communication shifts from broadcast or multicast packets to a structured exchange of information. This is where TCP port 5357 comes into play. It acts as the HTTP endpoint for these Web Services.
- Service Hosting: The Windows machine listens on port 5357 to host its own WSD endpoints. This allows other devices or services on the network to query the computer about its shared resources (like a shared printer or a fax service).
- Data Transfer: When you initiate a scan from a network scanner or check the ink levels of a printer via the Windows "Devices and Printers" interface, the control commands and status updates are often encapsulated in SOAP (Simple Object Access Protocol) messages sent over HTTP to or from port 5357.
- Binary Content: While the control logic is XML-based, actual document data or high-resolution scan images may also be transmitted via these web service channels, depending on the specific implementation of the hardware manufacturer.
The Relationship Between TCP 5357 and UDP 3702
It is impossible to discuss port 5357 without mentioning its "partner," UDP port 3702. The lifecycle of a WSD connection typically follows this path:
- Discovery (UDP 3702): When a printer is plugged into the network, it sends a "Hello" message via a multicast address on UDP port 3702 (WS-Discovery). Alternatively, when a Windows PC searches for new devices, it sends a "Probe" message on this same UDP port.
- Response (UDP 3702): The corresponding device responds to the Probe, providing its unique identifier and a transport address.
- Metadata Exchange (TCP 5357): Once the Windows PC knows the device exists, it establishes a TCP connection to port 5357 on the device (or vice versa) to retrieve the "Metadata." This metadata includes the manufacturer's name, model, supported functions (color vs. monochrome, duplexing, etc.), and the specific URLs for controlling the device.
- Eventing and Control (TCP 5357): Ongoing communication, such as subscribing to "Paper Jam" alerts or sending a "Start Scan" command, occurs over the established HTTP channel on port 5357.
Why Port 5357 Is Open on Your Machine
In our analysis of default Windows configurations, port 5357 is frequently found open because several core system services depend on it. These services are designed to ensure that the moment you bring a new device into your home or office network, it "just works."
Function Discovery Services
Two specific services are responsible for managing the activity on port 5357:
- Function Discovery Provider Host (fdPHost): This service hosts the discovery providers. If you disable this, the system will no longer be able to see other WSD-capable devices on the network.
- Function Discovery Resource Publication (FDResPub): This service publishes your computer and its shared resources so they can be discovered by other devices. If you see port 5357 listening, it is often this service holding the port open to handle incoming metadata requests.
Hardware Manufacturer Adoption
Major printer and scanner manufacturers have moved away from proprietary protocols in favor of WSD. Brands like HP, Canon, Brother, Epson, and Xerox all utilize WSD as a primary method for Windows integration. By using port 5357, these manufacturers can ensure their devices are compatible with Windows without requiring the user to manually enter an IP address or install a massive driver package immediately.
Security Considerations for Port 5357
As with any open port that accepts incoming connections, TCP port 5357 presents a potential attack surface. While it is not inherently "malicious," its presence in a network audit often raises questions.
Local Subnet Limitation
By design, WSD is a local network protocol. It relies on multicast for discovery, which usually does not cross router boundaries (unless specifically configured via a multicast proxy). Consequently, port 5357 should only ever be accessible to devices within the same local subnet or VLAN.
The Danger of Public Exposure: If a misconfigured firewall or an edge router with Universal Plug and Play (UPnP) enabled accidentally exposes port 5357 to the public internet, the risks increase exponentially. An attacker could fingerprint your Windows version, identify connected peripherals, and potentially gain insights into your internal network structure.
Information Disclosure and Fingerprinting
Even within a local network, port 5357 can be a goldmine for reconnaissance. During security assessments, we use simple HTTP requests to probe port 5357. A successful response can reveal:
- Hostnames and Workgroup Names: The XML metadata often includes the specific name of the computer.
- Device Metadata: It can reveal the exact model and firmware version of connected printers.
- Network Paths: Sometimes, internal paths or service configurations are leaked in the SOAP headers.
This information is invaluable for an attacker looking to perform "lateral movement." By knowing exactly what hardware is on the network, an attacker can look for specific vulnerabilities in that hardware's firmware to establish a foothold.
Debunking the SMBGhost Myth
There has been significant confusion in some online forums linking port 5357 to the SMBGhost (CVE-2020-0796) vulnerability. This is factually incorrect. SMBGhost is a critical vulnerability affecting the SMBv3 protocol, which operates on TCP port 445.
While both ports are common on Windows systems and both involve network communication, they serve entirely different purposes. Vulnerabilities in WSDAPI do occur—such as those patched in various Microsoft "Patch Tuesday" updates—but they should be tracked as separate entities from SMB-related issues. Always verify CVE details through the National Vulnerability Database (NVD) rather than relying on forum rumors.
How to Audit and Monitor Port 5357
If you are a network administrator, you should know how to verify the status of this port across your fleet.
Using Netstat to Check Port Status
To see if port 5357 is active on a local Windows machine, open PowerShell or Command Prompt as an Administrator and run:
netstat -ano | findstr :5357
The output will show the protocol (TCP), the local address (usually 0.0.0.0:5357), and the Process ID (PID) of the service listening on that port. You can then cross-reference that PID in the Task Manager to confirm it belongs to the "Service Host: Function Discovery Provider Host."
Using Nmap for Network Discovery
To scan for port 5357 across an entire subnet (e.g., 192.168.1.0/24), you can use Nmap:
nmap -sT -p 5357 192.168.1.0/24
In our testing, we have observed that many IoT devices, not just Windows PCs, will show this port as open. This is because modern "smart" office equipment runs a stripped-down web server to handle WSD requests.
Monitoring with Wireshark
To see the actual data being exchanged, a packet capture tool like Wireshark is essential. You can filter for tcp.port == 5357. You will likely see HTTP POST requests containing XML data. Look for the Envelope and Body tags in the SOAP messages to understand what the devices are saying to each other.
How to Disable or Restrict Port 5357
If your environment does not require network discovery of printers and scanners via WSD—for instance, in a highly secure server room or a specialized industrial control environment—you may choose to close this port to reduce your attack surface.
Method 1: Disabling Services
The most effective way to close the port is to stop the services that use it.
- Press
Win + R, typeservices.msc, and hit Enter. - Locate Function Discovery Provider Host.
- Right-click it, select Properties, change the "Startup type" to Disabled, and click Stop.
- Repeat the process for Function Discovery Resource Publication.
Note: Disabling these services will prevent your computer from being seen by other devices and will stop you from automatically discovering WSD printers.
Method 2: Windows Firewall Configuration
If you want to keep the services running but restrict who can talk to them, use the Windows Defender Firewall.
- Open Windows Defender Firewall with Advanced Security.
- Click on Inbound Rules.
- Look for rules named Web Services for Devices (HTTP-In).
- You can either disable these rules entirely or right-click Properties > Scope to limit the "Remote IP address" to specific trusted management stations or a specific local subnet.
Method 3: PowerShell Management
For automated deployments, you can use PowerShell to disable the relevant firewall rules:
Disable-NetFirewallRule -DisplayName "Web Services for Devices (HTTP-In)"
This command ensures that even if the services are running, the network traffic is dropped at the firewall level.
Comparing WSD to Traditional Printing Protocols
Many professionals ask if it is better to use WSD (Port 5357) or stick to older standards. Here is a comparison:
WSD (Web Services for Devices)
- Port: TCP 5357 (HTTP) / TCP 5358 (HTTPS).
- Pros: Zero-configuration, bidirectional (printer can "talk" back easily), better support for modern scanner features.
- Cons: Noisier network traffic due to frequent XML/SOAP heartbeats, potentially larger security surface.
IPP (Internet Printing Protocol)
- Port: TCP 631.
- Pros: Industry standard, supports strong authentication and encryption (IPPS), highly reliable.
- Cons: Sometimes requires more manual setup in Windows than WSD.
LPR/LPD (Line Printer Remote)
- Port: TCP 515.
- Pros: Extremely simple, supported by almost every networked printer made in the last 30 years.
- Cons: Legacy protocol, lacks advanced status reporting, unidirectional in many implementations.
In a modern office, IPP over TLS is generally considered the "gold standard" for security, but WSD remains the most user-friendly option for home and small business users.
Troubleshooting Common Issues with Port 5357
Sometimes, port 5357 can be the source of frustration rather than convenience. If you are experiencing issues with "Printer Offline" errors or a scanner that isn't found, consider these steps:
- Network Profile: Ensure your network connection is set to Private. Windows Firewall blocks most WSD traffic on Public networks to protect you in places like coffee shops.
- IP Address Changes: If your printer's IP address changes and it doesn't update via WS-Discovery (UDP 3702), the communication on TCP 5357 will fail. Setting a static IP for your printer often resolves this.
- Third-Party Antivirus: Many third-party security suites have their own firewalls that may block port 5357 even if the Windows Firewall allows it. Check your "Network Protection" or "HIPS" logs for blocked traffic.
Summary of Technical Specifications
For quick reference, here are the key technical details for TCP Port 5357:
- Primary Service: Microsoft Web Services for Devices (WSDAPI).
- Transport Layer: TCP.
- Application Layer: HTTP.
- Default State: Listening on most Windows client installations.
- Associated Ports: UDP 3702 (Discovery), TCP 5358 (Secure HTTPS WSD).
- Data Format: SOAP / XML.
- Scope: Local Area Network (LAN) only.
Conclusion
TCP port 5357 is a vital part of the modern Windows ecosystem, enabling the "Plug and Play" convenience we often take for granted with network hardware. While it facilitates easy communication with printers and scanners through WSDAPI, it is not without its risks. By maintaining a strict "Local Network Only" policy and ensuring your systems are updated with the latest security patches, you can enjoy the benefits of automated device discovery without exposing your network to unnecessary threats. If your specific environment demands maximum security, disabling the Function Discovery services is a straightforward way to close this port and harden your system.
Frequently Asked Questions
Is TCP port 5357 a virus?
No, TCP port 5357 is a legitimate Windows system port used by the Web Services for Devices API (WSDAPI). It is used for connecting to printers and scanners. However, like any port, it should be monitored for unusual activity.
Can I close port 5357?
Yes, you can close port 5357 by disabling the "Function Discovery Provider Host" and "Function Discovery Resource Publication" services in Windows. Note that doing so will stop your computer from automatically finding network printers.
Why does Nmap show port 5357 as open on my printer?
Many modern network printers use WSD to advertise their services to Windows computers. The printer runs a small web server listening on port 5357 so that Windows can query its capabilities and status.
What is the difference between port 5357 and 5358?
Port 5357 is used for unencrypted HTTP communication for WSD. Port 5358 is the secure counterpart, used for HTTPS communication when a secure channel is required for device interaction.
Does port 5357 affect internet speed?
No, the traffic on port 5357 is localized to your home or office network. It does not use your internet bandwidth unless you are incorrectly exposing it to the WAN, which should be avoided for security reasons.
-
Topic: Port 5357 – WSDAPI (Web Services for Devices) | PentestPadhttps://www.pentestpad.com/port-exploit/port-5357-wsdapi-web-services-for-devices
-
Topic: Internet-Security.com TCP port 5357 detailshttps://internet-security.com/ports/port-5357-TCP.html
-
Topic: Port 5357 (TCP UDP) for WSDAPI, detailed network port information database | WhatPortIs - Network Port Databasehttps://www.whatportis.com/ports/5357_web-services-for-devices-wsdapi