UPnP

Also known as: Universal Plug and Play

On this page 7

UPnP (Universal Plug and Play) is a set of networking protocols that lets devices on a local network discover each other automatically and request services, most notably asking a router to open inbound ports without manual configuration. In network security, UPnP matters because it allows any program on the internal network to change the firewall and NAT rules of the gateway, usually without authentication.

UPnP was designed for convenience in home and small office networks, where game consoles, media servers and video calling software need reachable ports. That same convenience turns it into a recurring source of unintended exposure, which is why security baselines treat it as a feature to evaluate carefully rather than leave enabled by default.

How UPnP discovery and port mapping work

UPnP works by combining multicast discovery, XML device descriptions and SOAP control messages over HTTP. A device first announces itself or searches for others through the Simple Service Discovery Protocol (SSDP), which sends HTTP-formatted messages over UDP to the multicast address 239.255.255.250 on port 1900.

When a client finds a router, it downloads the router’s description document and locates the Internet Gateway Device (IGD) service. Through the IGD control interface, the client sends an AddPortMapping request that names an external port, an internal IP address, an internal port, a protocol and a lease duration. The router then creates a dynamic NAT and firewall rule that forwards inbound traffic to the requesting host.

The following table summarizes the protocol layers that make up a typical UPnP exchange.

StepProtocol or formatPurpose
AddressingDHCP or link-local IPGives the device a usable address
DiscoverySSDP over UDP 1900Announces and finds devices and services
DescriptionXML over HTTPLists device capabilities and control URLs
ControlSOAP over HTTPInvokes actions such as AddPortMapping
EventingGENA notificationsReports state changes to subscribers
Layers of a UPnP exchange

The critical design point is that the original IGD specification assumes a trusted LAN. Any host that can reach the control URL may add, list or delete mappings, and the router has no built-in way to verify which user or application asked for the change.

Security risks introduced by UPnP

The main risk of UPnP is that it delegates firewall policy to endpoints, so a single compromised device can punch holes in the perimeter. Malware commonly uses UPnP to expose remote access services, run proxy nodes or make an infected camera reachable from the internet.

A second class of problems comes from flawed implementations rather than the protocol design. Some routers have exposed SSDP or the IGD control interface on the WAN side, allowing attackers on the internet to add mappings remotely or use the device for SSDP reflection and amplification in distributed denial-of-service attacks. The CallStranger vulnerability, disclosed in 2020, showed that the eventing subscription mechanism could be abused for data exfiltration and traffic amplification.

The table below maps the most common UPnP threats to their causes and effects.

ThreatRoot causeTypical impact
Malicious port openingNo authentication on IGDInternal host exposed to the internet
WAN-side exposureFaulty router firmwareRemote attackers modify NAT rules
SSDP amplificationResponses larger than requestsDevice joins DDoS attacks
Stale mappingsLeases set to zero or never removedPorts stay open after use ends
Parser vulnerabilitiesUnsafe XML or SOAP handlingRemote code execution on router
Common UPnP threats

Because port mappings are created silently, administrators often lose visibility of what is actually reachable. An external scan may reveal open ports that no one remembers approving, which complicates incident response and audits.

UPnP is one of several ways to let inbound traffic reach an internal host, and the alternatives differ mainly in who controls the rule and how it is authorized. Its closest relatives are NAT-PMP and the Port Control Protocol, which solve the same problem with simpler message formats.

MethodWho creates the ruleAuthenticationTypical setting
UPnP IGDAny LAN applicationNone by defaultHome and gaming networks
NAT-PMPAny LAN applicationNoneOlder Apple ecosystems
Port Control ProtocolAny LAN applicationOptional extensionsIPv4 and IPv6 gateways, carrier NAT
Manual port forwardingAdministratorRouter loginSmall business servers
DMZ hostAdministratorRouter loginIsolated public services
Overlay VPNVPN softwareKeys or identityRemote access without open ports
Ways to allow inbound connections

Unlike a DMZ or a carefully reviewed static rule, UPnP mappings change at runtime and are rarely logged. Unlike a VPN or zero trust network access, UPnP makes the internal service directly reachable by anyone on the internet, so the exposed application must defend itself entirely on its own.

Deciding whether to enable UPnP

Whether UPnP should be enabled depends on the trust level of the devices on the network and on whether an administrator is available to manage rules manually. The recommended default in managed environments is UPnP disabled, while some home networks accept it for specific applications.

EnvironmentRecommendationReason
Enterprise networkDisable on all gatewaysFirewall changes require change control
Small officeDisable and forward manuallyFew services, easy to document
Home with gaming consolesEnable only if needed, restrict scopeReduces strict NAT problems
Network with IoT devicesDisable or isolate IoT segmentCameras often request risky mappings
Guest networkNever enableUntrusted clients could open ports
UPnP decisions by environment

Where UPnP remains enabled, several controls reduce the attack surface considerably:

  • Restrict UPnP to the LAN interface and confirm that SSDP is not answered on the WAN with an external scan.
  • Use firmware that supports access control lists for UPnP, limiting which hosts and port ranges may request mappings.
  • Prefer short lease durations so unused mappings expire automatically.
  • Place IoT devices in a separate network segment where UPnP is not offered.
  • Review the router’s active mapping table regularly and log changes where possible.

Common misconceptions about UPnP

Several widespread beliefs about UPnP lead to poor decisions. The most frequent one is that UPnP itself is a vulnerability; in reality, the protocol behaves as designed, and the risk comes from its trust model and from weak implementations.

  • Disabling UPnP breaks all devices. Most devices continue to work for outbound traffic; only services needing inbound connections are affected.
  • UPnP only affects home networks. Small business routers and some enterprise branch devices also ship with it enabled.
  • NAT is a firewall. NAT hides addresses, but UPnP can modify it on request, so it provides no reliable protection.
  • UPnP is the same as DLNA. DLNA media sharing builds on UPnP device discovery, but disabling IGD port mapping does not necessarily stop local media streaming.

Put simply

Imagine a building where every resident can tell the front door guard to let strangers in for them, and the guard never asks who is speaking. That is roughly how UPnP works on a home router. A game console or a camera says it needs visitors from the internet, and the router opens a door for it automatically.

This saves people from complicated router settings, which is why it exists. The problem is that a harmful program can make the same request. The key takeaway is simple: UPnP trades convenience for control, so it is safest to turn it off unless a specific device truly needs it.

In practice

A small accounting office with eight workstations, a network printer and two security cameras asks an IT consultant to review its network. An external port scan of the office’s public address shows TCP port 8080 and port 554 open, even though no one ever configured port forwarding.

The consultant checks the router’s UPnP mapping table and finds that one camera requested both ports through UPnP IGD, exposing its web interface and video stream to the internet with factory credentials. The consultant disables UPnP on the router, moves the cameras to an isolated VLAN, and sets up a WireGuard VPN so the office manager can view footage remotely.

A second external scan confirms that no inbound ports remain open. The office keeps remote camera access, while the attack surface shrinks to a single authenticated VPN endpoint.