How can I close a port?

Important: An open port is not necessarily dangerous!

You are only at risk if the program using the port contains harmful code. So there is no reason to close all ports in your system. In fact without your ports being open, the internet simply wouldn’t work!

An open port is not an autonomous object, and should not be considered as something which can be destroyed by closing it. If a port is open on your computer, it means that there is an active program using this port number to communicate with other computers on the web. A port isn’t opened by the operating system, it’s opened by a specific program wanting to use it.

To close a port, it’s usually only necessary to shut down the program holding the port open. On some ports it’s enough to tell the program or service that the port should not be opened. A good example is the Microsoft Internet Information Services in Windows 2000 and Windows XP. If installed, they open three ports automatically: 21, 25 and 80. Port 21 is the FTP server, port 25 the SMTP server (email server) and port 80 the webserver for http.

The FTP server enables other internet users to download shared files from your system. They can also upload files to you, if you choose to permit this. The SMTP server is used to send emails directly to the recipient’s mailbox without the use of an external mailserver. The webserver allows you to run a website on your PC. But this is only reachable on your IP address. If you wish to make this accessible to the public, you need a domain name that redirects to a static IP address.

If however you don’t need all these servers, simply shut them down and the ports will be closed automatically. Open the service manager at the control panel – administrative tasks. Services are programs which are automatically run at the system startup without any visible window. They work in the background.

Search the list for “WWW publishing service” and click on Stop Service icon at the top. The port 80 is no longer in use, meaning that it is closed. You can do the same with the “FTP publishing service” and the “Simple mail transport protocol (SMTP)”.

However it is not always as easy to find out why a port is open. One example is port 5000 which is opened by Windows ME and XP by default. For this, there is no service which you can turn off. To close this port, it is necessary to actually uninstall a certain system component. Port 5000 is used for plug and play with network devices. If you close this port the network plug and play is no longer available.

Firewalls

Even if a port can’t be closed by shutting down a program or service, there are still other options for blocking communication to the port. Firewalls can prevent connections on specific ports. They work on the principle that data packages which use a specific port on a network are filtered. However, firewalls only provide passive security. Meaning you may have a trojan installed on your computer, but it can’t connect to the attacker beause the firewall is blocking the connection.

There are different firewall concepts. On the one side there are Desktop-Firewalls
like Online Armor Personal Firewall or Zonealarm, which are installed locally on the PC they protect. These firewalls are located upon the network driver layer of the operating system, and prevent connections to or from specific blocked ports. But there’s also an obstacle here. Programs or trojans which don’t use the network driver of the operating system can’t be prevented from making a connection to outside the computer. If an attacker can install a trojan with it’s own network driver on your PC, a desktop firewall would not help.

A more secure technique is to install a firewall on a second computer. Usually a whole network of computers can only send data to the internet over a firewall server. The computers in the network don’t have a direct connection to the internet. All data is transmitted by the firewall, and can therefore be blocked as and when required. Most of such firewalls are also able to analyze the data packages. So for example if a harmless email is transferred, the firewall can check that there are no viruses attached to the email, and filter the attachment before sending the mail to the target PC. In general however, good firewalls tend to be fairly expensive and usually require special hardware.

Have a Great (Malware-Free) Day!