Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
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.

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.
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.
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.
SSH provides three forwarding modes, and they are the ones that matter inside an organisation.
ssh -L 8080:internal-db:5432 bastion) makes a remote service appear on the client’s own machine. Used legitimately to reach a database through a bastion host.ssh -R 2222:localhost:22 external-host) opens a listener on a remote machine that reaches back into the local network. This is a reverse tunnel, and it is how an attacker — or a frustrated employee — creates inbound access through an outbound-only firewall.ssh -D 1080 host) turns the connection into a SOCKS proxy, routing arbitrary traffic through it and around web filtering entirely.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.
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.
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.
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.
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.
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.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.