3.8 Information Services
Three standard protocols, finger [Harrenstien, 1977], whois [Harrenstien et al., 1985], and LDAP [Yeong et al., 1995], are commonly used to look up information about individuals. Whois is usually run on one of the hosts serving the Internet registrar databases. Finger is run on many hosts by default. Finger is sometimes used to publish public key data as well.
3.8.1 Finger: Looking Up People
The finger protocol can be used to get information about either an individual user or the users logged on to a system. The amount and quality of the information returned can be cause for concern. Farmer and Venema [1993] call finger "one of the most dangerous services, because it is so useful for investigating a potential target." It provides personal information, which is useful for password-guessing; where the user last connected from (and hence a likely target for an indirect attack); and when the account was last used (seldom-used accounts are attractive to hackers, because their owners are not likely to notice their abuse).
Finger is rarely run on firewalls, and hence is not a major concern for firewalled sites. If someone is on the inside of your firewall, they can probably get a lot of the same information in other ways. But if you do leave machines exposed to the outside, you'd be wise to disable or restrict the finger daemon.
3.8.2 WhoisDatabase Lookup Service
This simple service is run by the various domain name registries. It can be used to look up domain name ownership and other such information in their databases.
We wouldn't bother mentioning this servicemost people run the client, not the serverbut we know of several cases in which this service was used to break into the registrar databases and make unauthorized changes. It seems that the whois server wasn't checking its inputs for shell escapes.
If you run one of the few sites that need to supply this service, you should check the code carefully. It has not been widely run and examined, and has a history of being dangerous.
3.8.3 LDAP
More and more, sites are using Lightweight Directory Access Protocol (LDAP) [Yeong et al., 1995] to supply things like directory data and public key certificates. Many mailers can be con-figured to use LDAP instead of or in addition to a local address book. Danger lurks here.
First, of course, there's the semantic similarity to finger: It's providing the same sorts of information, and thus shares the same risks. Second, it uses ASN.1, and inherits those vulnerabilities. Finally, if you do decide to deploy it, be careful to choose a suitable authentication mechanism from among the many available [Wahl et al., 2000].
3.8.4 World Wide Web
The World Wide Web (WWW) service has grown so explosively that many laypeople confuse this single service with the entire Internet. Web browsers will actually process a number of Internet services based on the name at the beginning of the Uniform Resource Locator (URL). The most common services are HTTP, with FTP a distant second.
Generally, a host contacts a server, sends a query or information pointer, and receives a response. The response may be either a file to be displayed or one or more pointers to some other server. The queries, the documents, and the pointers are all potential sources of danger.
In some cases, returned document formats include format tags, which implicitly specify the program to be used to process the document. It is dangerous to let someone else decide what program you should run, and even more dangerous when they get to supply the input.
Similarly, MIME encoding can be used to return data to the client. As described earlier, numerous alligators lurk in that swamp; great care is advised.
The server is in some danger, too, if it blindly accepts URLs. URLs generally have file-names embedded in them [Berners-Lee et al., 1994]; are those files ones that should be available to users? Although the servers do attempt to verify that the requested files are authorized for transfer, the verification process is historically buggy. These programs often botch the processing of "..", for example, and symbolic links on the server can have unforeseen effects. Failures here can let outsiders retrieve any file on the server's machine.
Sometimes, the returned pointer is a host address and port, and a short login dialog. We have heard of instances where the port was actually the mail port, and the dialog a short script to send annoying mail to someone. That sort of childish behavior falls in the nuisance category, but it may lead to more serious problems in the future. If, for example, a version of telnet becomes popular that uses preauthenticated connections, the same stunt could enable someone to log in and execute various commands on behalf of the attacker.
One danger in this vein results when the server shares a directory tree with anonymous FTP. In that case, an attacker can first deposit control files and then ask the Web server to treat them as CGI scripts, i.e., as programs to execute. This danger can be avoided if all publicly writable directories in the anonymous FTP area are owned by the group under which the information server runs, and the group-search bit is turned off for those directories. That will block access by the server to anything in those directories. (Legitimate uploads can and should be moved to a permanent area in a write-protected directory.) The biggest danger, though, is from the queries. The most interesting ones do not involve a simple directory lookup. Rather, they run some script written by the information providerand that means that the script is itself a network server, with all the dangers that entails. Worse yet, these scripts are often written in Perl or as shell scripts, which means that these powerful interpreters must reside in the network service area.
If at all possible, WWW servers should execute in a restricted environment, preferably safeguarded by chroot (see Section 8.5 for further discussions).
This section deals with security issues on the WWW as a service, in the context of our security review of protocols. Chapter 4 is devoted entirely to the Web, including the protocols, client issues, and server issues.
3.8.5 NNTPNetwork News Transfer Protocol
Netnews is often transferred by the Network News Transfer Protocol (NNTP) [Kantor and Lapsley, 1986]. The dialog is similar to that used for SMTP. There is some disagreement about how NNTP should be passed through firewalls.
The obvious way is to treat it the same as mail. That is, incoming and outgoing news articles should be processed and relayed by the gateway machine. But there are a number of disadvantages to that approach.
First of all, netnews is a resource hog. It consumes vast amounts of disk space, file slots, inodes, CPU time, and so on. At this writing, some report the daily netnews volume at several gigabytes.2 You may not want to bog down your regular gateway with such matters. Concomitant with this are the associated programs to manage the database, notably expire and friends. These take some administrative effort, and represent a moderately large amount of software for the gateway administrator to have to worry about.
Second, all of these programs may represent a security weakness. There have been some problems in nntpd, as well as in the rest of the netnews subsystem. The news distribution software contains snntp, which is a simpler and probably safer version of nntp. It lacks some of nntp's functionality, but is suitable for moving news through a gateway. At least neither server needs to run as root.
Third, many firewall architectures, including ours, are designed on the assumption that the gateway machine may be compromised. That means that no company-proprietary newsgroups should reside on the gateway, and that it should therefore not be an internal news hub.
Fourth, NNTP has one big advantage over SMTP: You know who your neighbors are for NNTP. You can use this information to reject unfriendly connection requests.
Finally, if the gateway machine does receive news, it needs to use some mechanism, probably NNTP, to pass on the articles received. Thus, if there is a hole in NNTP, the inside news machine would be just as vulnerable to attack by whomever had taken over the gateway.
For all these reasons, some people suggest that a tunneling strategy be used instead, with NNTP running on an inside machine. They punch a hole in their firewall to let this traffic in.
Note that this choice isn't risk-free. If there are still problems in nntpd, the attacker can pass through the tunnel. But any alternative that doesn't involve a separate transport mechanism (such as uucp, although that has its own very large share of security holes) would expose you to similar dangers.
3.8.6 Multicasting and the MBone
Multicasting is a generalization of the notions of unicast and broadcast. Instead of a packet being sent to just one destination, or to all destinations on a network, a multicast packet is sent to some subset of those destinations, ranging from no hosts to all hosts. The low-order 28 bits of a IPv4 multicast address identify the multicast group to which a packet is destined. Hosts may belong to zero or more multicast groups.
On wide area links, the multicast routers speak among themselves by encapsulating the entire packet, including the IP header, in another IP packet, with a normal destination address. When the packet arrives on that destination machine, the encapsulation is stripped off. The packet is then forwarded to other multicast routers, transmitted on the proper local networks, or both. Final destinations are generally UDP ports.
Specially configured hosts can be used to tunnel multicast streams past routers that do not support multicasting. They speak a special routing protocol, the Distance Vector Multicast Routing Protocol (DVMRP). Hosts on a network inform the local multicast router of their group memberships using IGMP, the Internet Group Management Protocol [Cain et al., 2002]. That router, in turn, forwards only packets that are needed by some local machines. The intent, of course, is to limit the local network traffic.
A number of interesting network applications use the MBonethe multicast backbone on the Internetto reach large audiences. These include two-way audio and sometimes video transmissions of things like Internet Talk Radio, meetings of the Internet Engineering Task Force (IETF), NASA coverage of space shuttle activity, and even presidential addresses. (No, the space shuttle coverage isn't two-way; you can't talk to astronauts in midflight. But there are plans to connect a workstation on the space station to the Internet.) A session directory service provides information on what "channels"multicast groups and port numbersare available.
The MBone presents problems for firewall-protected sites. The encapsulation hides the ultimate destination of the packet. The MBone thus provides a path past the filtering mechanism. Even if the filter understands multicasting and encapsulation, it cannot act on the destination UDP port number because the network audio sessions use random ports. Nor is consulting the session directory useful. Anyone is allowed to register new sessions, on any arbitrary port above 3456. A hacker could thus attack any service where receipt of a single UDP packet could do harm. Certain RPC-based protocols come to mind. This is becoming a pressing problem for gatekeepers as internal users learn of multicasting and want better access through a gateway.
By convention, dynamically assigned MBone ports are in the range 3276965535. To some extent, this can be used to do filtering, as many hosts avoid selecting numbers with the sign bit on. The session directory program provides hooks that allow the user to request that a given channel be permitted to pass through a firewall (assuming, of course, that your firewall can respond to dynamic reconfiguration requests). Some older port numbers are grandfathered.
A better idea would be to change the multicast support so that such packets are not delivered to ports that have not expressly requested the ability to receive them. It is rarely sensible to hand multicast packets to nonmulticast protocols.
If you use multicasting for internal purposes, you need to ensure that your sensitive internal traffic is not exported to the Internet. This can be done by using short TTLs and/or the prefix allocation scheme described in RFC 2365 [Meyer, 1998].