← All cybersecurity posts

Open Ports and Security Risks: Which Ports Should Never Be Public

Every open port is a service listening for connections. Some, like HTTPS on 443, are meant to be public. Many others end up exposed by accident, and automated scanners across the internet find them within hours.

Ports that should rarely be public

PortServiceRisk if exposed
22SSHBrute force, exploitation of outdated servers
3389RDPBrute force, ransomware entry point
3306MySQLData theft, credential attacks
5432PostgreSQLData theft, credential attacks
27017MongoDBHistorically exposed without authentication
6379RedisOften no authentication, can lead to code execution
9200ElasticsearchData exposure if unauthenticated
2375Docker APIFull host control
6443, 10250Kubernetes API, kubeletCluster compromise if misconfigured
11211MemcachedData exposure, amplification attacks
5900VNCRemote desktop access
445SMBExploits and data access
8080, 8000, 9000Dev servers and admin UIsDebug interfaces, dashboards

Why accidental exposure happens

  • A developer opens a database to their home IP and uses 0.0.0.0/0 instead.
  • A container publishes a port on all interfaces by default.
  • A test server is launched with a default security group.
  • A managed service is created with public access enabled.
  • A firewall change during an incident is never reverted.

How attackers find open ports

Attackers do not need to target you specifically. Internet-wide scanning tools sweep every IPv4 address regularly, and search engines index exposed services by software and version. An exposed database can be found and attacked within hours of going live.

Reducing exposure

  1. Default deny inbound. Only open what must be public, typically 80 and 443.
  2. Use private networking for databases, caches and internal services.
  3. Use bastion alternatives, such as cloud session managers or identity-aware proxies, instead of public SSH and RDP.
  4. Bind services to localhost or private interfaces, not 0.0.0.0.
  5. Require authentication on every service, even internal ones.
  6. Manage firewall rules as code, with review.
  7. Monitor continuously for new exposures.

Checking your own exposure

You can scan your own IP addresses and domains with standard tools, or use continuous external monitoring. Make sure to include all cloud accounts and regions, IPv6 addresses, and domains pointing to third-party hosting.

SecurityInfinity's network agent continuously discovers open ports across your domains and IPs, identifies services and versions, matches them to known CVEs and flags services that should not be public. Start free.

Frequently asked questions

Is it safe to expose SSH with key authentication?

Key-only authentication is much safer than passwords, but exposing SSH still invites attacks on the service itself. Restrict access by IP or use a session manager where possible.

Are non-standard ports safer?

Moving a service to an unusual port reduces noise from basic scans, but internet-wide scanners check all ports. It is not a security control.

What should I do if I find an exposed database?

Restrict access immediately, rotate its credentials, and review logs for unauthorised access, assuming data may have been accessed.

Find what attackers can see, before they do.

AI pentesting agents test your web app, API and cloud, and every finding comes with evidence and a fix. First report in about 10 minutes.

Stay ahead of attackers.

New vulnerabilities, breach write-ups and practical fixes. A few emails a month.