Commonly Exploited Port Numbers and How to Protect Them
Which ports attackers target most (22, 23, 445, 3389, 3306, 6379, 2375) and how to harden and monitor them on Linux and cloud servers.
Attackers probe the ports that expose remote access, file sharing and data stores most often: SSH (22), Telnet (23), SMB (445), RDP (3389), databases such as MySQL (3306) and Redis (6379), and the Docker API (2375). Protection comes from closing what you do not need, restricting the rest to known sources, patching and watching the logs.
This guide is written for defenders: Linux administrators, DevOps engineers and students who run servers and want to know which listening ports deserve attention first. It sits under our networking pillar, What Is the OSI Model and Why Is It Still Relevant Today?, and every port number below was checked against the IANA Service Name and Transport Protocol Port Number Registry in November 2026. It explains the risk behind each port and how to harden and monitor it. It does not cover attack techniques.
Key takeaways
- A port is only risky when a service listens on it and the network lets the wrong people reach it. An open port number by itself is not a vulnerability.
- Remote administration (SSH, RDP, Telnet, VNC) and file sharing (SMB) are the services most often named in CISA and Microsoft guidance about real incidents.
- Databases, caches and container APIs (Redis, MongoDB, Elasticsearch, Docker, the kubelet) should almost never be reachable from the internet.
- UDP services such as DNS, NTP, SNMP and Memcached can be abused to amplify denial-of-service traffic, so lock them down even when they hold no data.
- Moving a service to a non-standard port cuts log noise but does not stop a scanner that checks all 65,535 ports.
- Your best controls are a default-deny firewall, private networking, strong authentication, patching and alerting on unexpected listeners.
How port numbers work, in two minutes
TCP and UDP use 16-bit port numbers, so each protocol has ports 0 to 65535. RFC 6335 splits them into three ranges: System Ports (0 to 1023), User Ports (1024 to 49151) and Dynamic or Private Ports (49152 to 65535). IANA records which service is registered on which System and User port. Registration is a convention, not a rule: nothing stops a service from listening on another port, and many popular tools use defaults that IANA lists under a different name. Elasticsearch's default HTTP port 9200, for example, is registered to an old WAP service.
When a client connects, it sends packets to an IP address and a destination port. If a process is listening and the firewall allows the traffic, the connection reaches that process. Every exposed service is therefore a piece of software that strangers can send input to. That is why the useful question is "which services are reachable, by whom, and are they patched?" rather than "which numbers are dangerous?". For a broader look at exposure, read our companion post on the security implications of open network ports.
The commonly exploited ports at a glance
The table lists ports that repeatedly appear in CISA advisories, Microsoft security bulletins and vendor hardening guides. It is not a ranked "top N" list, because attack volume varies by sensor, region and month, and no single public data set measures it neutrally.
| Port | Protocol | Service (IANA name) | Why it attracts attackers | First defensive move |
|---|---|---|---|---|
| 21 | TCP | FTP control (ftp) | Credentials and files travel in clear text; anonymous login is sometimes left on | Replace with SFTP or HTTPS; disable anonymous access |
| 22 | TCP | SSH (ssh) | Constant password guessing against internet-facing servers | Key-only login, no root login, source IP allowlist |
| 23 | TCP | Telnet (telnet) | No encryption; default passwords on routers and IoT devices | Disable; use SSH |
| 25 | TCP | SMTP (smtp) | Open relays get abused for spam and phishing | Allow relaying only for authenticated users |
| 53 | UDP/TCP | DNS (domain) | Open resolvers are used to amplify DDoS traffic | Answer recursive queries only for your own networks |
| 135, 137-139 | TCP/UDP | RPC endpoint mapper (epmap), NetBIOS | Windows service discovery and lateral movement | Block at the network edge |
| 161 | UDP | SNMP (snmp) | Default community strings leak device details; amplification | SNMPv3 with authentication; management network only |
| 445 | TCP | SMB (microsoft-ds) | Wormable flaws such as the ones fixed in MS17-010; ransomware spread | Block inbound and outbound at the perimeter; disable SMBv1 |
| 1433 | TCP | Microsoft SQL Server (ms-sql-s) | Password guessing and exposed default configurations | Private subnet only; strong authentication |
| 2375 | TCP | Docker REST API, plain text (docker) | Unauthenticated access equals root on the host | Never expose; use SSH or TLS on 2376 |
| 3306 | TCP | MySQL (mysql) | Exposed databases and weak passwords | Bind to private interfaces; firewall to app servers |
| 3389 | TCP/UDP | RDP (ms-wbt-server) | Brute force and flaws such as BlueKeep (CVE-2019-0708) | VPN or gateway with MFA; NLA; patch |
| 5432 | TCP | PostgreSQL (postgresql) | Exposed databases and weak passwords | Private network; pg_hba.conf rules; TLS |
| 5900 | TCP | VNC / Remote Framebuffer (rfb) | Weak or missing passwords on remote desktops | Tunnel through SSH or VPN |
| 6379 | TCP | Redis (redis) | Instances with no password, reachable from anywhere | Keep protected-mode on; bind to localhost or private IP; ACLs |
| 11211 | UDP/TCP | Memcached (memcache) | Very high DDoS amplification over UDP | Disable UDP; never expose to the internet |
| 27017 | TCP | MongoDB (mongodb) | Databases exposed without authentication | Enable access control; keep bindIp private |
| 80 / 443 | TCP (443 also UDP for HTTP/3) | HTTP (http), HTTPS (https) | Must be public, so attackers target the web application behind them | Patch, WAF where useful, redirect 80 to 443 |
Remote access ports: 22, 23, 3389 and 5900
SSH (22)
SSH is encrypted and safe by design, but any SSH server on a public IP receives a steady stream of automated login attempts. The risk is weak or reused passwords, not the protocol. Turn off password authentication, require keys (or certificates), block direct root login and limit who can connect. On a RHEL or Rocky Linux server the core settings live in /etc/ssh/sshd_config or a drop-in file under /etc/ssh/sshd_config.d/:
PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
MaxAuthTries 3
AllowGroups sshadmins
Run sudo sshd -t to check the syntax, then sudo systemctl reload sshd. Keep an existing session open while you test a new one so you cannot lock yourself out. Our guide to secure SSH access in Linux covers key management in more depth.
Telnet (23)
Telnet sends usernames and passwords in clear text. It survives mainly on old network gear and cheap IoT devices, often with factory credentials. Disable it and use SSH. If a device only supports Telnet, put it on an isolated management VLAN that ordinary users cannot reach.
RDP (3389)
RDP is a frequent ransomware entry point. The CISA #StopRansomware Guide tells organisations not to expose services such as RDP on the web, to audit systems that use it, close unused RDP ports and enforce account lockouts, MFA and logging. BlueKeep (CVE-2019-0708) showed the other risk: a flaw in Remote Desktop Services that allowed unauthenticated remote code execution on older Windows versions. Patch, require Network Level Authentication, and publish RDP only through a VPN or Remote Desktop Gateway with MFA.
VNC (5900)
The Remote Framebuffer protocol (RFC 6143) is common on Linux desktops and lab machines. Many VNC setups use short passwords and weak encryption. Bind the VNC server to localhost and reach it through an SSH tunnel or VPN.
File sharing and Windows services: 445, 135 and 137-139
SMB on TCP 445 carries Windows file and printer sharing. In March 2017 Microsoft bulletin MS17-010 fixed several SMBv1 remote code execution flaws, including CVE-2017-0144, which an unauthenticated attacker could trigger with a crafted packet. The WannaCry outbreak a few weeks later spread through unpatched SMBv1 systems.
CISA's SMB guidance is direct: block all versions of SMB at the network boundary by blocking TCP 445, together with UDP 137-138 and TCP 139. The #StopRansomware Guide adds that you should block TCP 445 both inbound and outbound at internet perimeter firewalls and disable SMBv1 once you have removed dependencies on it. Inside the network, segment file servers so that a single infected laptop cannot reach every share.
Databases, caches and container APIs
Data stores were built to sit behind application servers, not on the open internet. Most incidents here come from configuration rather than clever exploits: a database bound to 0.0.0.0, a cloud security group that allows 0.0.0.0/0, or a test instance with no password that was never shut down.
- MySQL (3306), PostgreSQL (5432), SQL Server (1433): place them in private subnets, allow traffic only from the application tier, require TLS and use separate low-privilege accounts per application.
- Redis (6379): the default configuration binds to
127.0.0.1 -::1and enablesprotected-mode. Keep both, add ACL users with passwords, and never publish the port from a container to all interfaces. - MongoDB (27017): MongoDB binds to localhost by default, but access control is not on by default. Enable authentication before you widen
net.bindIp. - Elasticsearch (9200 by convention): recent versions turn on security features by default. Do not disable them to "make it work", and keep the cluster on a private network.
- Memcached (11211): CISA's UDP amplification alert lists Memcached with an amplification factor of 10,000 to 51,000. Disable UDP and bind to private addresses.
Container platforms add their own high-value ports. The Docker documentation says the daemon uses a local UNIX socket by default and that remote access should go through SSH or TLS on TCP 2376. Anyone who can talk to the Docker API can start a privileged container, which is root on the host, so the plain-text port 2375 should never be reachable from another machine. Kubernetes lists its control-plane ports on kubernetes.io: the API server on 6443, etcd on 2379-2380, and the kubelet API on 10250. Only the API server should face users, and even that belongs behind a private endpoint or allowlist in most clusters.
UDP amplification: 53, 123, 161 and 11211
Some UDP services send a large reply to a small request. Because UDP does not confirm the sender's address, an attacker can spoof a victim's IP and let your server flood the victim. CISA alert TA14-017A lists DNS, NTP, SNMPv2, SSDP, CLDAP, Memcached and others as amplification vectors. Your server may hold nothing of value and still become part of an attack.
The CISA mitigations apply to any team that runs these services: disable services you do not need, block internet access to services meant for local use, rate-limit legitimate UDP services, and watch for unusually large responses to a single address. Network providers should also filter spoofed source addresses following BCP 38.
Web ports 80 and 443: public by design
You cannot close 80 and 443 on a public website, so the risk moves up the stack to the web server, framework and application code. Port 443 being "secure" only means the traffic is encrypted. SQL injection, broken authentication and vulnerable plugins all arrive over HTTPS. Patch web servers and frameworks, redirect HTTP to HTTPS, set security headers, run dependency and DAST scans in your pipeline, and put administrative paths (such as /admin or a Jenkins dashboard on 8080) behind a VPN or SSO rather than on the public listener. Our list of ports and protocols every cloud engineer should know covers which of these are expected to be public.
A hardening checklist for Linux servers
- Inventory listeners. Run
sudo ss -tulpnon each host and record every port, process and bind address. Anything bound to0.0.0.0or[::]that should be local is a finding. - Default-deny firewall. Allow only the services the host exists to provide. Repeat the same rules in cloud security groups or network ACLs.
- Restrict by source. Admin ports (22, 3389, 5900, 6443) should accept connections only from a VPN range, bastion host or office IPs.
- Remove clear-text protocols. Replace Telnet with SSH, FTP with SFTP and SNMPv1/v2c with SNMPv3.
- Patch exposed services first. CISA advises prioritising internet-facing servers and vulnerabilities in its Known Exploited Vulnerabilities catalogue.
- Use strong authentication. Keys or certificates for SSH, MFA for VPN and RDP gateways, and unique credentials for every database user.
- Scan yourself. Run authorised scans of your own public IP ranges on a schedule so you see what the internet sees.
On RHEL-family systems, firewalld makes the default-deny pattern easy to apply. The commands below list the active zone, remove a service you do not need and allow SSH from one internal range only:
sudo firewall-cmd --list-all
sudo firewall-cmd --permanent --remove-service=cockpit
sudo firewall-cmd --permanent --remove-service=ssh
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.10.0.0/16" service name="ssh" accept'
sudo firewall-cmd --reload
Run these from a console session or confirm that your own address falls inside the allowed range before you reload. More examples are in our RHEL 10 firewalld commands guide, and the post on how firewalls secure ports and protocols explains stateful filtering.
Monitoring: how to spot trouble early
Hardening reduces exposure; monitoring tells you when something changed or when someone is trying. Useful signals that need no expensive tooling:
| Signal | Where to find it | What to alert on |
|---|---|---|
| Failed SSH logins | journalctl -u sshd or /var/log/secure | Bursts from one source; any success after many failures |
| New listening port | Scheduled ss -tulpn diff, configuration management, EDR | Any listener not in the approved baseline |
| Firewall denies | firewalld logging (--set-log-denied), cloud flow logs | Repeated denied hits on 445, 3389 or database ports |
| Security group changes | Cloud audit logs (for example AWS CloudTrail) | Rules opening admin or database ports to 0.0.0.0/0 |
| Outbound SMB or RDP | Perimeter firewall logs | Internal hosts connecting out on 445 or 3389 |
| UDP response volume | NetFlow or VPC flow logs | Large replies to a single external IP from DNS, NTP or SNMP |
Tools such as fail2ban can block sources that fail SSH logins repeatedly, and a SIEM or the ELK stack can correlate these events across servers. Feed the alerts into the same on-call process you use for outages.
Does changing the default port help?
Moving SSH from 22 to, say, 2222 cuts the number of automated login attempts in your logs, which makes real attacks easier to see. It does not make a weak password safe, because a scanner can check every port on a host within minutes. Treat port changes as noise reduction and rely on keys, allowlists and patching for protection. On SELinux-enforcing systems you must also label the new port (semanage port -a -t ssh_port_t -p tcp 2222) or sshd will fail to bind.
Learn to run secure Linux and DevOps infrastructure
Port hardening is daily work for Linux administrators and DevOps engineers. Our Linux administration training covers firewalld, SSH, SELinux and service management on RHEL, and the DevOps training program extends that to cloud security groups, containers and monitoring. Classes run in our Kharadi, Pune classroom and live online across India. If you are starting with Linux, begin with setting up RHEL 10 for the first time.
Frequently asked questions
Which port is attacked the most?
There is no single neutral ranking. SSH (22), RDP (3389), SMB (445), Telnet (23) and web ports (80, 443) appear in most vendor and government reports, but the order changes with the sensor network, region and time period. Focus on which of these you actually expose.
Is an open port a vulnerability?
Not by itself. An open port means a service is listening and reachable. The risk depends on that service's configuration, authentication and patch level, and on who can reach it. A patched web server on 443 is expected; an unauthenticated Redis on 6379 facing the internet is a serious problem.
Should I block port 445 on my firewall?
Yes, at the internet perimeter. CISA recommends blocking TCP 445, UDP 137-138 and TCP 139 at the network boundary, inbound and outbound. Inside the network, allow SMB only between clients and the file servers they need, and disable SMBv1.
Is it safe to expose RDP if I use a strong password?
It is still risky. CISA advises against exposing RDP on the web at all. Flaws such as BlueKeep needed no password. Put RDP behind a VPN or Remote Desktop Gateway with MFA, enable Network Level Authentication and keep Windows patched.
Does moving SSH to a different port make it secure?
No. It reduces automated noise in your logs, but a full port scan finds the new port quickly. Use key-based login, disable root login, restrict source IPs and keep OpenSSH updated.
How do I see which ports are open on my Linux server?
Run sudo ss -tulpn. It lists TCP and UDP listening sockets with the owning process and bind address. Compare it with your firewall rules using sudo firewall-cmd --list-all on RHEL-family systems, and check cloud security groups separately.
Why is Docker port 2375 so dangerous?
Port 2375 is the plain-text Docker API. Anyone who can reach it can start privileged containers, which gives root access to the host. Docker's documentation recommends SSH or mutual TLS on port 2376 for remote access.
What are UDP amplification attacks?
An attacker sends small spoofed requests to a UDP service, such as DNS, NTP, SNMP or Memcached, which replies with much larger responses to the victim's address. Disable unneeded UDP services, restrict them to internal clients and rate-limit the ones you must run.
References
- IANA: Service Name and Transport Protocol Port Number Registry
- RFC 6335: IANA Procedures for the Management of the Service Name and Transport Protocol Port Number Registry
- CISA: #StopRansomware Guide
- CISA: SMB Security Best Practices
- CISA: UDP-Based Amplification Attacks (TA14-017A)
- Microsoft Security Bulletin MS17-010
- NSA: Patch Remote Desktop Services on Legacy Versions of Windows (BlueKeep)
- Docker Docs: Protect the Docker daemon socket
- Kubernetes: Ports and Protocols
- CISA: Known Exploited Vulnerabilities Catalog
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0