Guides · ← All guides
Open Ports on a Web Server: Which Ones Should Never Face the Internet
Published: November 14, 2026 · Last reviewed: November 14, 2026 · 8 min read
Run a free BreachHunter assessment on your site →
The port scan is the phase of an assessment owners understand fastest — it is literally a list of doors — and the phase whose findings age worst, because ports get opened for a debugging session at 11 PM and the firewall ticket to close them never gets written. Cloud defaults make it worse: a security group created in a hurry tends toward “allow from anywhere”.
This guide uses the scanner's own model: the ports it probes, the banners it grabs, and the distinction it draws between risky ports (a finding with a severity) and merely open ones (a LOW note asking “is this meant to be public?”). It ends with the firewall patterns that keep the list at two.
Which ports does an assessment treat as risky, and why?
The pattern is services with their own authentication and exploit history that assume a trusted network: databases (3306 MySQL, 5432 PostgreSQL, 27017 MongoDB), caches that double as data stores (6379 Redis), remote administration (22 SSH, 3389 RDP), and mail/legacy services left from a previous life of the server. The scanner grabs each open port's banner — the greeting the service sends — because a banner like a database version string converts “port open” into “this exact software, this exact version, reachable by anyone”.
History justifies the severity. The 2017 MongoDB ransom wave — tens of thousands of internet-facing databases wiped and held for ransom — required no vulnerability at all, just an open port and no authentication. Redis instances left public have been conscripted into botnets the same way. When the report rates an open database port HIGH, it is pricing the fact that exploitation is a solved, scripted problem.
Open does not always mean wrong — but it must mean deliberate
The scanner files non-risky open ports as LOW with a specific question attached: confirm this service is intended to be public. Some are: a mail server needs its ports; a game or API service may legitimately listen elsewhere. The finding is the forcing function — every open port should have an owner who can say why it is open, in the change log, not in a shrug.
The durable controls are boring and complete. Default-deny inbound at the cloud security group or host firewall, with explicit allows for 80/443 and an SSH rule scoped to your office or bastion addresses. Bind internal services to localhost or the private interface so even a firewall mistake leaves them unreachable — defense in depth the scanner verifies indirectly, because a service bound to 127.0.0.1 simply never answers its probe. And re-scan after infrastructure changes: the port list is the fastest-decaying part of any report, as the drift guide explains.
Worked example: meridianprint.example
Meridian Print Shop's server hosted its storefront and, unknown to the owners, the database the storefront talked to — on the public interface, left over from a developer's remote-debugging setup two years earlier. The port phase of the assessment returned:
PORT STATE SERVICE BANNER 80/tcp open http 443/tcp open https 22/tcp open ssh OpenSSH_8.9p1 3306/tcp open mysql MySQL 8.0.x <- RISKY: database facing the internet
No evidence suggested the database had been reached — its account passwords were strong — but “probably not” is not a posture. The shop bound MySQL to localhost, scoped SSH to the developer's fixed IP, and set the cloud firewall to default-deny. Retest showed exactly two public ports. The owners added the scan's port table to their quarterly review, because the developer's debugging need will recur and now has a closing step.
The five actions to take
Getting your public port list down to deliberate:
- Run the scan (or nmap your own IP) and list every open port with its banner — no port without a named owner and reason.
- Bind databases, caches and admin services to localhost or the private network; they should never answer on the public interface.
- Scope SSH/RDP to specific source IPs or a bastion/VPN — never 0.0.0.0/0.
- Set the cloud security group / host firewall to default-deny inbound and add explicit allows only.
- Re-scan after every infrastructure change and quarterly otherwise; treat any new open port as a change to explain.
Run a free BreachHunter assessment on your site →
Frequently asked questions
Our database has a strong password. Is an open 3306 still a finding?
Yes. A public database port invites brute force, credential stuffing and every future CVE in that database's network parser — against a service that was designed for a trusted LAN. Password strength reduces one route; removing the port removes the category.
Why does the report list port 22 as risky if we need SSH?
It lists the exposure, and the expected answer is scoping: key-only auth, a fixed source range or a bastion, and fail2ban-style throttling. SSH open to the whole internet with password auth is the risky shape; SSH itself is a legitimate service.
What is a banner and why does the scan record it?
The banner is the greeting text a service sends on connect — often its name and version. The scan stores it as evidence because “port open” plus an exact version tells an attacker precisely which exploits apply, and tells you exactly what is listening.
Can a firewall alone fix this if the services stay bound to all interfaces?
A correctly configured default-deny firewall does make them unreachable from the internet, and the scan will pass. Binding to localhost as well is still recommended: it protects you on the day the firewall rule is edited by someone in a hurry.
How often do port findings appear on ordinary small-business servers?
Constantly — they are among the most common HIGH findings in assessments, almost always leftovers: a debugging session, a migrated service, a default cloud image. That ordinariness is the point of scanning on a schedule.
Sources
Where this guide's claims come from, in citable form:
- Nmap documentation (2025) — how port scanning and banner grabbing actually work.
- NIST SP 800-53 Rev. 5 (2020) — boundary protection: deny by exception, allow by necessity.