Explore our new Cybersecurity Terms Glossary, explained by our experts.

View the Glossary View the Glossary
PRIVIA

Cybersecurity Terms Glossary

What Is Port Forwarding?

Port forwarding publishes an internal service to the outside world, or tunnels a connection through one that is already permitted. Both uses create exposure worth tracking.

Illustration for the cybersecurity term Port Forwarding
Home / Blog / Cybersecurity Terms / What Is Port Forwarding?
17 November 2026

What Is Port Forwarding?

What Is Port Forwarding?

Port forwarding tells a device that traffic arriving on a particular port should be sent somewhere else. In its most familiar form it is a rule on a router: connections to the public address on TCP 3389 are delivered to a machine inside the network. In its second form it is a tunnel established by a client, where SSH or a similar protocol carries traffic for an entirely different service inside an already-permitted connection. The two look unrelated in a configuration file and share the same security property: both create a path that the network design did not intend.

Inbound Forwarding at the Perimeter

A destination NAT rule publishes an internal service. It is how a small office makes a camera system or a remote desktop reachable, and it is a leading cause of compromise.

Exposed Remote Desktop is the clearest example. Scanning the whole IPv4 space for port 3389 takes minutes, and services such as Shodan maintain the results continuously. Ransomware operators have used exposed RDP as an initial access vector for years, usually through credential stuffing or a password found in an infostealer log rather than through an exploit. Where an exploit is used, BlueKeep, tracked as CVE-2019-0708, showed what unauthenticated remote code execution on a directly exposed service looks like.

The same applies to database ports, management interfaces, network video recorders, and building management systems. A forwarding rule created for a legitimate reason in 2019 and never reviewed is a standard finding in external testing.

UPnP: Forwarding Without Approval

Universal Plug and Play and NAT-PMP let a device on the internal network ask the router to create its own forwarding rule, with no authentication and no record anyone reads. Consumer and small business routers enable this by default. Malware uses it to make a compromised host externally reachable, and games consoles and media devices use it routinely, which is why nobody notices the unusual request among the normal ones. Disable it on anything corporate, and check it on home routers used for remote working.

Outbound Tunnelling

SSH provides three forwarding modes, and they are the ones that matter inside an organisation.

Commercial tunnelling services have made this easier still. Tools that publish a local service to a public URL over an outbound HTTPS connection need no firewall change, no privileged access, and no technical sophistication. Several ransomware affiliates have used them for persistence precisely because the traffic looks like ordinary web browsing.

Reducing the Exposure

For inbound, the answer is mostly to stop doing it. Remote access belongs behind a VPN with multi-factor authentication or, better, behind ZTNA that publishes the application rather than the network. Where a service genuinely must be public, put it behind a reverse proxy or WAF, never forward a management protocol directly, restrict source addresses where the client population allows it, and audit every existing rule against a named owner and a business justification. Rules without both should be removed.

For outbound, restrict where it can go. An egress policy that permits outbound only to approved destinations through a proxy removes most tunnelling options at a stroke. Disable AllowTcpForwarding and GatewayPorts on SSH servers that do not need them. Watch for the behavioural signs in flow data: long-lived connections with steady bidirectional traffic, unusual destination ports, and client fingerprints that do not match a browser.

Our Infrastructure Security Testing Services enumerate what your perimeter actually publishes, which is reliably more than the firewall documentation says.

FAQ – Frequently Asked Questions

Is Port Forwarding Inherently Insecure?

The mechanism is neutral; the exposure it creates is the issue. Forwarding a hardened, patched, authenticated service to the internet with monitoring in place is a managed risk. Forwarding a management protocol such as RDP or a database port directly is not, because those services were designed on the assumption of a trusted network around them.

Why Should I Disable UPnP?

Because it lets any device on the internal network create its own inbound forwarding rule without authentication or approval. Malware uses it to expose a compromised host to the internet, turning an internal infection into externally reachable infrastructure. Disable it on corporate routers and firewalls, and handle genuine inbound needs through reviewed rules with a named owner.

How Do I Detect SSH Tunnelling?

Look for behaviour rather than signatures. Long-lived outbound SSH connections with sustained bidirectional traffic, SSH to destinations outside your known estate, and internal hosts listening on unexpected local ports are all indicators. Restricting outbound traffic to approved destinations through a proxy is far more effective than detection, because it removes most of the available paths.

What Should I Use Instead of Forwarding RDP?

Place remote access behind a VPN requiring multi-factor authentication, or use ZTNA so that users reach a specific application rather than the network. A Remote Desktop Gateway with MFA is an acceptable middle ground. Whatever you choose, never expose 3389 directly, because it is scanned continuously and credential attacks against it are entirely automated.

Related Terms

You May Be Interested In These

What Is Dependency Confusion?

Cybersecurity Terms

17 November 2026

What Is Dependency Confusion?

Read More
What Are Scalping Bots?

Cybersecurity Terms

17 November 2026

What Are Scalping Bots?

Read More