Application Layer Ports and Sockets

The Application Layer is the most visible layer because it interacts with software applications that need access to network services and resources. When an application wants to request (consume) a service, such as a webpage, it sends a network message to a specific server. However, modern servers commonly provide lots of services, so how does the server know what a remote process wants? In addition to sending a request to a server, a service requester (i.e., a client) also provides a port number with the request. A port is just a number that tells the server what type of service the client is requesting. On the server, many programs run as services, which are programs that monitor a specific port for requests. When a server receives a request for a service at a specific port, the Application Layer passes the request to the service listening on the specified port. An instance of a service listening for traffic on a specific port is called a socket.

Each service uses a port number to help direct traffic. There are 65,536 ports, which are divided into well-known ports (0–1023), registered ports (1024–49151), and dynamic ports (49152–65535). Although there are hundreds of ports and corresponding applications, in practice, fewer than 100 are in common use. Of these, only a handful will be encountered on a regular basis. The most common of these are shown in TABLE 6-3.

TABLE 6-3 Computer ports, services, and protocols.
PORT SERVICE PROTOCOL
20/21 File Transfer Protocol (FTP) data/FTP command TCP
22 SSH/Secure File Transfer Protocol (SFTP) TCP
23 Telnet TCP
25 Simple Mail Transfer Protocol (SMTP) TCP
53 Domain Name Service (DNS) TCP/UDP
67/68 Dynamic Host Configuration Protocol (DHCP) UDP
69 Trivial File Transfer Protocol (TFTP) UDP
79 Finger protocol (user information) TCP
80 Hypertext Transfer Protocol (HTTP) TCP
88 Kerberos UDP
110 Post Office Protocol version 3 (POP3) TCP
111 Sun Microsystems Remote Procedure Call (SUNRPC) TCP/UDP
123 Network Time Protocol (NTP) UDP
135 Microsoft Remote Procedure Call (MS RPC) TCP/UDP
139 NetBIOS Session TCP/UDP
143 Internet Message Access Protocol (IMAP) TCP
156 Structured Query Language (SQL) service TCP/UDP
161 Simple Network Management Protocol (SNMP) UDP
162 SNMP Trap UDP
179 Border Gateway Protocol (BGP) TCP/UDP
389 Lightweight Directory Access Protocol (LDAP) TCP
443 Hypertext Transfer Protocol Secure (HTTPS) TCP
445 Server Message Block (SMB) over IP TCP/UDP

You should practice the deny-all principle and enable just those ports that are needed instead of memorizing each port and deciding whether or not to block it. Simply put, you should block everything and allow only what is needed. If a port is not being used, and deny-all is the practice, it will already be closed.

Because the most popular protocol suite, Transmission Control Protocol/Internet Protocol (TCP/IP), was designed when more trust was given to networks, all applications are not created equally. Although some, such as SSH, are designed to be secure, you might encounter the less secure options in practice. The following list discusses the operation and security issues of some of the common applications:

  • DNS—Domain Name System (DNS) operates on port 53 and performs address translation. DNS serves a critical function in that it converts fully qualified domain names (FQDNs) into numeric IP addresses or IP addresses into FQDNs. DNS uses UDP and TCP.
  • FTPFile Transfer Protocol (FTP) is a TCP service that operates on ports 20 and 21. This application is used to move files from one computer to another. Port 20 is used for the data stream and transfers the data between the client and the server. Port 21 is the control stream and is used to pass commands between the client and the FTP server.
  • HTTPHypertext Transfer Protocol (HTTP) is a TCP service that operates on port 80. HTTP uses a request–response protocol in which a client sends a request and a server sends a response. Because HTTP is generally on web servers, and web servers are a very public and exposed asset, the protocol is commonly exploited by all sorts of threats, including malware.
  • SNMPSimple Network Management Protocol (SNMP) is a UDP service for sharing and collecting information about network devices; it operates on ports 161 and 162. Some of the security problems that plague SNMP are caused because community strings (which act as a pseudo-password) can be passed as cleartext, and the default community strings (public/private) are well known. SNMP version 3 is the most current, and it offers authentication and encryption.
  • Telnet—Telnet is a TCP service that operates on port 23. Telnet enables a client at one site to establish a session with a host at another site. The program passes the information typed at the client’s keyboard to the host computer system. Telnet sends data in the clear, which makes it easy for an attacker with a sniffer to see everything that is typed—including passwords.
  • SMTPSimple Mail Transfer Protocol (SMTP) is a TCP service that operates on port 25. It is designed for the exchange of electronic mail between networked systems. Spoofing and spamming are two of the vulnerabilities associated with SMTP.
  • TFTPTrivial File Transfer Protocol (TFTP) operates on UDP port 69. It also requires no authentication, which could pose a big security risk. It is used to transfer router configuration files, and by cable companies to configure cable modems.

NOTE

Every firewall is different with respect to configuration, but by default most firewalls have most, if not all, their default ports and services disabled. It is up to each organization to determine what must be enabled to make the network usable and to enable just those features necessary to function. The first step in configuring network devices for any organization is to understand what network services that organization needs to operate. Then, provide access for only those services.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.91.47