UPnP: Convenience and Risk
Learn what UPnP does on your router, why it can open ports without asking and how to decide whether to leave it switched on.
Key takeaways
- UPnP covers local discovery and control; the router feature that matters for security is automatic port mapping.
- Requests from devices on your network are typically accepted without a password.
- Any program or gadget inside, including a compromised one, can ask to be exposed to the internet.
- Disabling it on the router stops automatic openings but may affect some games, calls and remote access features.
- Whatever you decide, review the mapping list and never expose UPnP to the internet side.
Universal Plug and Play (UPnP) lets devices on your network find each other and, on most routers, lets them ask the router to open inbound ports automatically. That second ability is why a game console can set itself up for online play without your help. It is also why security advice often says to turn it off.
The right choice depends on what is on your network and what you actually need. This guide explains the mechanism, the risk and the alternatives.
Two things under one name
UPnP is a family of protocols for devices to announce themselves and be controlled over a local network. A device finds others with SSDP (Simple Service Discovery Protocol), which sends messages to a multicast address, 239.255.255.250, on UDP port 1900. Descriptions and control requests then travel over HTTP.
Media players finding a media server use this kind of discovery. So does the part that concerns us: the Internet Gateway Device (IGD) profile, through which a program asks a router about its connection and requests port mappings.
You may be able to disable gateway port mapping on the router while local media discovery between your devices keeps working, since that discovery doesn't depend on the router offering to open ports.
Why port mappings are needed at all
Your router uses network address translation. Unsolicited packets from the internet match no existing connection, so they are dropped. A game that hosts a match, or a program that wants peers to connect to it, needs a rule saying "send port such-and-such to this device".
You could create that rule by hand, as in port forwarding. UPnP automates it.
Where the risk lies
The design assumes that anything on your local network is trustworthy. That assumption has aged badly, as homes now hold cameras, televisions, plugs and appliances of widely varying quality.
Silent exposure. A device may open a port the moment you set it up, putting its admin page or video stream within reach of anyone on the internet. If that device has a weak default password or an unpatched flaw, it can be taken over. Compromised gadgets are a well-known way botnets get recruited.
Malicious software. Malware already on a computer can use the same request to make itself reachable or to expose another device on your network.
Buggy implementations. Some routers have had flaws in their UPnP software, including ones that answered requests arriving from the internet side. A router that accepts mapping requests from outside is a serious fault.
Little visibility. Many people never look at the list of active mappings, and some router interfaces hide it.
UPnP does not by itself let an outsider into a network whose devices and router are sound. The usual problem is that something inside asks for an opening you would never have approved.
Should you turn it off?
For many households that only browse, stream and use cloud-based apps, disabling it changes nothing noticeable. Gamers who host sessions are the group most likely to notice, often through a console reporting a stricter NAT type.
How to disable it and check what happens
- Sign in to your router's admin page.
- Look under settings such as Advanced, NAT, WAN or Security. The label may read UPnP, UPnP IGD or similar; menus vary by maker.
- Before switching it off, note the current mapping list, which shows which devices were relying on it.
- Turn it off and save. Restart the router so existing automatic rules are cleared.
- Use your games, calls and remote access tools over the next few days and see whether anything complains.
- If something does, find that product's documented ports and decide whether a manual rule is justified.
Also check the router's port forwarding page for entries you don't recognize and remove them.
Seeing active mappings
If your router doesn't show them, the open source miniupnpc client, available from many Linux package managers, can list mappings on your own network:
upnpc -l Read each entry as: an outside port, an inside address and port, a protocol and a description supplied by whoever asked. The description is free text, so don't trust it. Match the inside address to a device using your router's client list; see seeing every device on your network.
An entry pointing to a camera, storage box or computer's remote desktop port deserves immediate attention.
Related protocols
Two other mechanisms do a similar job. NAT-PMP (RFC 6886), associated with Apple equipment, and its successor Port Control Protocol (RFC 6887) let a host request mappings from a gateway. They are simpler and, in the newer case, designed to work with larger provider-level translators and IPv6 firewalls. The underlying trade is the same: convenience in exchange for letting inside devices open the door. If your router offers these under separate switches, decide about each.
Reducing risk if you keep it on
- Install router firmware updates, and replace a router that no longer receives them.
- Put cameras, plugs and televisions on a guest or separate network, and check whether your router lets that network request mappings.
- Change default passwords on every device.
- Where offered, use settings that let a device map ports only to itself.
- Look at the mapping list now and then, especially after adding new equipment.
Safer ways to get what you wanted
Think about why the port was opened. Usually it is one of a few goals, and each has a calmer route.
Reaching your own files or cameras while away. A VPN into your home, or a mesh VPN service, exposes a single hardened entry point, or none at all, instead of each gadget. See reaching home with your own VPN.
Hosting a game for friends. Add one manual forward for the game's documented port to the machine running it, and delete the rule when the session ends. Hosting a game server walks through the other precautions.
Better console connectivity. Try a manual forward of the ports the console maker publishes, pointed at the console's reserved address. Fix any double NAT first, since that is a more common cause.
A media server you want to share. Many offer their own relay or sign-in based remote access. If you do forward a port, keep the server updated and use strong, unique credentials.
Manual rules have one advantage that is easy to overlook: you know they exist. Keep a short note listing each forward, why you made it and the date. A rule nobody remembers is a risk nobody manages.
If you think something was exposed
Finding an unexpected mapping doesn't mean a break-in happened, but treat it seriously.
- Remove the mapping and disable UPnP so it can't return.
- Identify the device. Change its password to a unique one and install its latest firmware.
- If the device was reachable with a default or weak password, reset it to factory settings and set it up afresh.
- Check the router too: its administrator password, DNS server settings and firmware version.
- Scan any computer involved with reputable security software.
Router settings worth changing is a good checklist to run through while you are in the admin pages. If a device is no longer supported by its maker and has been exposed, replacing it may be the sensible end of the story.
Finally, put a reminder on your calendar to look at the router again after a few months. Firmware updates and factory resets sometimes restore default settings, and a feature you switched off may quietly return. The same visit is a good time to remove forwards for games you no longer play and devices you no longer own, and to confirm that remote administration from the internet is still disabled.
When UPnP changes nothing
Automatic mapping can't help if there is a second router in front of yours: your router opens its own door while the outer one stays shut. It also can't help behind carrier-grade NAT, where your provider's translator ignores your requests. In both cases a game may report a restrictive connection with UPnP fully enabled, and the fix lies elsewhere.
Many modern services avoid the question altogether. They keep an outbound connection to the maker's servers or use traversal techniques with relays, so no inbound rule is needed. When you shop for a camera or similar device, check how it offers remote access and what the maker can see as a result.
Common questions
Does turning off UPnP break Wi-Fi?
No. Your wireless network, internet access and ordinary browsing don't depend on it.
Is UPnP the same as WPS?
No. WPS is a way of joining devices to Wi-Fi without typing the passphrase. They are separate switches with separate risks, and both are worth reviewing on a new router.