Internet Firewalls Frequently Asked Questions Marcus J. Ranum and Matt Curtin $Date: 1998/05/26 18:07:00 $ Welcome to the Internet Firewalls Frequently Asked Questions file. Contents Administrativia About the FAQ Where Can I Find the Current Version of the FAQ? Contributors Copyright and Usage Background and Firewall Basics What is a network firewall? Why would I want a firewall? What can a firewall protect against? What can't a firewall protect against? What about viruses? What are good sources of print information on firewalls? Where can I get more information on firewalls on the network? Design and Implementation Issues What are some of the basic design decisions in a firewall? What are some of the basic types of firewall? What are proxy servers and how do they work? What are some cheap packet screening tools? What are some reasonable filtering rules for a Cisco? What are the critical resources in a firewall? What is a DMZ, and why do I want one? How might I increase the security and scalability of my DMZ? What is a `single point of failure', and how do I avoid having one? How can I block all of the bad stuff? Various Attacks What is source routed traffic and why is it a threat? What are ICMP redirects and redirect bombs? What about denial of service? What are some common attacks, and how can I protect my system against them? How do I... Do I really want to allow everything that my users ask for? How do I make Web/http work with a firewall? How do I make DNS work with a firewall? How do I make FTP work through my firewall? How do I make Telnet work through my firewall? How do I make Finger and whois work through my firewall? How do I make gopher, archie, and other services work through my firewall? What are the issues about X11 through a firewall? How do I make RealAudio work through my firewall? How do I make my web server act as a front-end for a database that lives on my private network? But my database has an integrated web server, and I want to use that. Can't I just poke a hole in the firewall and tunnel that port? Appendices What are some commercial products or consultants who sell/service firewalls? Glossary of firewall related terms Administrativia About the FAQ This FAQ is not an advertisement or endorsement for any product, company, or consultant. The maintainers welcome input and comments on the contents of this FAQ. Comments related to the FAQ should be addressed to firewalls-faq@interhack.net . Where Can I Find the Current Version of the FAQ? The FAQ can be found on the web at and . It's also posted monthly to comp.security.firewalls , comp.security.unix , comp.security.misc , comp.answers , and news.answers and archived in all the usual places. Unfortunately, the version posted to USENET and archived from that version lack the pretty pictures and useful hyperlinks found in the web version. Contributors: Primary Authors / Maintainers Marcus Ranum , Matt Curtin Cisco Config (V2.0) ~Keinanen Vesa Cisco Config (V1.0) ~Allen Leibowitz DNS Hints Brent Chapman , Great Circle Associates Policy Brief ~Brian Boyle , AT&T Copyright and Usage Copyright © 1995-1998 Marcus J. Ranum. Copyright © 1998 Matt Curtin. All rights reserved. This document may be used, reprinted, and redistributed as is providing this copyright notice and all attributions remain intact. Background and Firewall Basics What is a network firewall? A firewall is a system or group of systems that enforces an access control policy between two networks. The actual means by which this is accomplished varies widely, but in principle, the firewall can be thought of as a pair of mechanisms: one which exists to block traffic, and the other which exists to permit traffic. Some firewalls place a greater emphasis on blocking traffic, while others emphasize permitting traffic. Probably the most important thing to recognize about a firewall is that it implements an access control policy. If you don't have a good idea what kind of access you want to permit or deny, or you simply permit someone or some product to configure a firewall based on what they or it think it should do, then they are making policy for your organization as a whole. Why would I want a firewall? The Internet, like any other society, is plagued with the kind of jerks who enjoy the electronic equivalent of writing on other people's walls with spraypaint, tearing their mailboxes off, or just sitting in the street blowing their car horns. Some people try to get real work done over the Internet, and others have sensitive or proprietary data they must protect. Usually, a firewall's purpose is to keep the jerks out of your network while still letting you get your job done. Many traditional-style corporations and data centers have computing security policies and practices that must be adhered to. In a case where a company's policies dictate how data must be protected, a firewall is very important, since it is the embodiment of the corporate policy. Frequently, the hardest part of hooking to the Internet, if you're a large company, is not justifying the expense or effort, but convincing management that it's safe to do so. A firewall provides not only real security - it often plays an important role as a security blanket for management. Lastly, a firewall can act as your corporate "ambassador" to the Internet. Many corporations use their firewall systems as a place to store public information about corporate products and services, files to download, bug-fixes, and so forth. Several of these systems have become important parts of the Internet service structure (e.g.: UUnet.uu.net, whitehouse.gov, gatekeeper.dec.com) and have reflected well on their organizational sponsors. What can a firewall protect against? Some firewalls permit only Email traffic through them, thereby protecting the network against any attacks other than attacks against the Email service. Other firewalls provide less strict protections, and block services that are known to be problems. Generally, firewalls are configured to protect against unauthenticated interactive logins from the "outside" world. This, more than anything, helps prevent vandals from logging into machines on your network. More elaborate firewalls block traffic from the outside to the inside, but permit users on the inside to communicate freely with the outside. The firewall can protect you against any type of network-borne attack if you unplug it. Firewalls are also important since they can provide a single "choke point" where security and audit can be imposed. Unlike in a situation where a computer system is being attacked by someone dialing in with a modem, the firewall can act as an effective "phone tap" and tracing tool. Firewalls provide an important logging and auditing function; often they provide summaries to the administrator about what kinds and amount of traffic passed through it, how many attempts there were to break into it, etc. What can't a firewall protect against? Firewalls can't protect against attacks that don't go through the firewall. Many corporations that connect to the Internet are very concerned about proprietary data leaking out of the company through that route. Unfortunately for those concerned, a magnetic tape can just as effectively be used to export data. Many organizations that are terrified (at a management level) of Internet connections have no coherent policy about how dial-in access via modems should be protected. It's silly to build a 6-foot thick steel door when you live in a wooden house, but there are a lot of organizations out there buying expensive firewalls and neglecting the numerous other back-doors into their network. For a firewall to work, it must be a part of a consistent overall organizational security architecture. Firewall policies must be realistic, and reflect the level of security in the entire network. For example, a site with top secret or classified data doesn't need a firewall at all: they shouldn't be hooking up to the Internet in the first place, or the systems with the really secret data should be isolated from the rest of the corporate network. Another thing a firewall can't really protect you against is traitors or idiots inside your network. While an industrial spy might export information through your firewall, he's just as likely to export it through a telephone, FAX machine, or floppy disk. Floppy disks are a far more likely means for information to leak from your organization than a firewall! Firewalls also cannot protect you against stupidity. Users who reveal sensitive information over the telephone are good targets for social engineering; an attacker may be able to break into your network by completely bypassing your firewall, if he can find a "helpful" employee inside who can be fooled into giving access to a modem pool. What about viruses? Firewalls can't protect very well against things like viruses. There are too many ways of encoding binary files for transfer over networks, and too many different architectures and viruses to try to search for them all. In other words, a firewall cannot replace security- consciousness on the part of your users. In general, a firewall cannot protect against a data-driven attack -- attacks in which something is mailed or copied to an internal host where it is then executed. This form of attack has occurred in the past against various versions of sendmail and ghostscript, a freely-available PostScript viewer. Organizations that are deeply concerned about viruses should implement organization-wide virus control measures. Rather than trying to screen viruses out at the firewall, make sure that every vulnerable desktop has virus scanning software that is run when the machine is rebooted. Blanketing your network with virus scanning software will protect against viruses that come in via floppy disks, modems, and Internet. Trying to block viruses at the firewall will only protect against viruses from the Internet -- and the vast majority of viruses are caught via floppy disks. Nevertheless, an increasing number of firewall vendors are offering "virus detecting" firewalls. They're probably only useful for naive users exchanging Windows-on-Intel executable programs and malicious-macro-capable application documents. Do not count on any protection from attackers with this feature. What are good sources of print information on firewalls? There are several books that touch on firewalls. The best known are: Firewalls and Internet Security: Repelling the Wily Hacker Authors: Bill Cheswick and Steve Bellovin Publisher: Addison Wesley Edition: 1994 ISBN: 0-201-63357-4 Building Internet Firewalls Authors: D. Brent Chapman and Elizabeth Zwicky Publisher: O'Reilly Edition: 1995 ISBN: 1-56592-124-0 Practical Internet & Unix Security Authors: Simson Garfinkel and Gene Spafford Publisher: O'Reilly Edition: 1996 ISBN: 1-56592-148-8 (discusses primarily host security) Related references are: Internetworking with TCP/IP Vols , II and III Authors: Douglas Comer and David Stevens Publisher: Prentice-Hall Edition: 1991 ISBN: 0-13-468505-9 (I), 0-13-472242-6 (II), 0-13-474222-2 (III) Comment: A detailed discussion on the architecture and implementation of the Internet and its protocols. Vol I (on principles, protocols and architecture) is readable by everyone, Vol 2 (on design, implementation and internals) is more technical, and Vol 3 (on client-server computing) is recently out. Unix System Security--A Guide for Users and System Administrators Author: David Curry Publisher: Addison Wesley Edition: 1992 ISBN: 0-201-56327-4 Where can I get more information on firewalls on the Internet? Firewalls mailing list archives. The internet firewalls mailing list is a forum for firewall administrators and implementors. To subscribe to Firewalls, send subscribe firewalls in the body of a message (not on the "Subject:" line) to Majordomo@GreatCircle.COM. Firewall HOWTO -- A how-to-build firewalls document. Internet firewall toolkit and papers. Marcus Ranum's firewall related publications Papers on firewalls and breakins. Texas A&M University security tools. COAST Project Internet Firewalls page Design and Implementation Issues What are some of the basic design decisions in a firewall? There are a number of basic design issues that should be addressed by the lucky person who has been tasked with the responsibility of designing, specifying, and implementing or overseeing the installation of a firewall. The first and most important is reflects the policy of how your company or organization wants to operate the system: is the firewall in place to explicitly deny all services except those critical to the mission of connecting to the net, or is the firewall in place to provide a metered and audited method of "queuing" access in a non-threatening manner. There are degrees of paranoia between these positions; the final stance of your firewall may be more the result of a political than an engineering decision. The second is: what level of monitoring, redundancy, and control do you want? Having established the acceptable risk level (e.g.: how paranoid you are) by resolving the first issue, you can form a checklist of what should be monitored, permitted, and denied. In other words, you start by figuring out your overall objectives, and then combine a needs analysis with a risk assessment, and sort the almost always conflicting requirements out into a laundry list that specifies what you plan to implement. The third issue is financial. We can't address this one here in anything but vague terms, but it's important to try to quantify any proposed solutions in terms of how much it will cost either to buy or to implement. For example, a complete firewall product may cost between $100,000 at the high end, and free at the low end. The free option, of doing some fancy configuring on a Cisco or similar router will cost nothing but staff time and cups of coffee. Implementing a high end firewall from scratch might cost several man- months, which may equate to $30,000 worth of staff salary and benefits. The systems management overhead is also a consideration. Building a home-brew is fine, but it's important to build it so that it doesn't require constant and expensive fiddling-with. It's important, in other words, to evaluate firewalls not only in terms of what they cost now, but continuing costs such as support. On the technical side, there are a couple of decisions to make, based on the fact that for all practical purposes what we are talking about is a static traffic routing service placed between the network service provider's router and your internal network. The traffic routing service may be implemented at an IP level via something like screening rules in a router, or at an application level via proxy gateways and services. The decision to make is whether to place an exposed stripped-down machine on the outside network to run proxy services for telnet, ftp, news, etc., or whether to set up a screening router as a filter, permitting communication with one or more internal machines. There are pluses and minuses to both approaches, with the proxy machine providing a greater level of audit and potentially security in return for increased cost in configuration and a decrease in the level of service that may be provided (since a proxy needs to be developed for each desired service). The old trade-off between ease-of-use and security comes back to haunt us with a vengeance. What are the basic types of firewalls? Conceptually, there are two types of firewalls: Network Level Application Level They are not as different as you might think, and latest technologies are blurring the distinction to the point where it's no longer clear if either one is "better" or "worse." As always, you need to be careful to pick the type that meets your needs. Network level firewalls generally make their decisions based on the source, destination addresses and ports in individual IP packets. A simple router is the "traditional" network level firewall, since it is not able to make particularly sophisticated decisions about what a packet is actually talking to or where it actually came from. Modern network level firewalls have become increasingly sophisticated, and now maintain internal information about the state of connections passing through them, the contents of some of the data streams, and so on. One thing that's an important distinction about many network level firewalls is that they route traffic directly though them, so to use one you usually need to have a validly assigned IP address block. Network level firewalls tend to be very fast and tend to be very transparent to users. Example Network level firewall: In this example, a network level firewall called a "screened host firewall" is represented. In a screened host firewall, access to and from a single host is controlled by means of a router operating at a network level. The single host is a bastion host; a highly-defended and secured strong-point that (hopefully) can resist attack. Example Network level firewall: In this example, a network level firewall called a "screened subnet firewall" is represented. In a screened subnet firewall, access to and from a whole network is controlled by means of a router operating at a network level. It is similar to a screened host, except that it is, effectively, a network of screened hosts. Application level firewalls generally are hosts running proxy servers, which permit no traffic directly between networks, and which perform elaborate logging and auditing of traffic passing through them. Since the proxy applications are software components running on the firewall, it is a good place to do lots of logging and access control. Application level firewalls can be used as network address translators, since traffic goes in one "side" and out the other, after having passed through an application that effectively masks the origin of the initiating connection. Having an application in the way in some cases may impact performance and may make the firewall less transparent. Early application level firewalls such as those built using the TIS firewall toolkit, are not particularly transparent to end users and may require some training. Modern application level firewalls are often fully transparent. Application level firewalls tend to provide more detailed audit reports and tend to enforce more conservative security models than network level firewalls. Example Application level firewall: In this example, an application level firewall called a "dual homed gateway" is represented. A dual homed gateway is a highly secured host that runs proxy software. It has two network interfaces, one on each network, and blocks all traffic passing through it. The Future of firewalls lies someplace between network level firewalls and application level firewalls. It is likely that network level firewalls will become increasingly "aware" of the information going through them, and application level firewalls will become increasingly "low level" and transparent. The end result will be a fast packet-screening system that logs and audits data as it passes through. Increasingly, firewalls (network and application layer) incorporate encryption so that they may protect traffic passing between them over the Internet. Firewalls with end-to-end encryption can be used by organizations with multiple points of Internet connectivity to use the Internet as a "private backbone" without worrying about their data or passwords being sniffed. What are proxy servers and how do they work? A proxy server (sometimes referred to as an application gateway or forwarder) is an application that mediates traffic between a protected network and the Internet. Proxies are often used instead of router-based traffic controls, to prevent traffic from passing directly between networks. Many proxies contain extra logging or support for user authentication. Since proxies must "understand" the application protocol being used, they can also implement protocol specific security (e.g., an FTP proxy might be configurable to permit incoming FTP and block outgoing FTP). Proxy servers are application specific. In order to support a new protocol via a proxy, a proxy must be developed for it. One popular set of proxy servers is the TIS Internet Firewall Toolkit ("FWTK") which includes proxies for Telnet, rlogin, FTP, X-Window, http/Web, and NNTP/Usenet news. SOCKS is a generic proxy system that can be compiled into a client-side application to make it work through a firewall. Its advantage is that it's easy to use, but it doesn't support the addition of authentication hooks or protocol specific logging. For more information on SOCKS, see What are some cheap packet screening tools? The Texas AMU security tools include software for implementing screening routers. Karlbridge is a PC-based screening router kit available from . A version of the Digital Equipment Corporation "screend" kernel screening software is available for BSD-derived operating systems. There are numerous kernel-level packet screens, including ipf, ipfw, and ipfwadm. Typically, these are included in various free Unix implementations, such as FreeBSD , OpenBSD , NetBSD , and Linux . You might also find these tools available in your commercial Unix implementation. If you're willing to get your hands a little dirty, it's completely possible to build a secure and fully functional firewall for the price of hardware and some of your time. What are some reasonable filtering rules for a Cisco? The following example shows one possible configuration for using the Cisco as filtering router. It is a sample that shows the implementation of as specific policy. Your policy will undoubtedly vary. In this example, a company has Class C network address 195.55.55.0. Company network is connected to Internet via IP Service Provider. Company policy is to allow everybody access to Internet services, so all outgoing connections are accepted. All incoming connections go through "mailhost". Mail and DNS are only incoming services. Implementation Allow all outgoing TCP-connections Allow incoming SMTP and DNS to mailhost Allow incoming FTP data connections to high TCP port (>1024) Try to protect services that live on high port numbers Only incoming packets from Internet are checked in this configuration. Rules are tested in order and stop when the first match is found. There is an implicit deny rule at the end of an access list that denies everything. This IP access lists assumes that you are running Cisco IOS v. 10.3 or later. no ip source-route ! interface ethernet 0 ip address 195.55.55.1 ! interface serial 0 ip access-group 101 in ! access-list 101 deny ip 195.55.55.0 0.0.0.255 access-list 101 permit tcp any any established ! access-list 101 permit tcp any host 195.55.55.10 eq smtp access-list 101 permit tcp any host 195.55.55.10 eq dns access-list 101 permit udp any host 192.55.55.10 eq dns ! access-list 101 deny tcp any any range 6000 6003 access-list 101 deny tcp any any range 2000 2003 access-list 101 deny tcp any any eq 2049 access-list 101 deny udp any any eq 2049 ! access-list 101 permit tcp any 20 any gt 1024 ! access-list 101 permit icmp any any ! snmp-server community FOOBAR RO 2 line vty 0 4 access-class 2 in access-list 2 permit 195.55.55.0 255.255.255.0 Explanations Drop all source-routed packets. Source routing can be used for address spoofing. If incoming packet claims to be from local net, drop it. All packets which are part of already established TCP-connections can pass through without further checking. All connections to low port numbers are blocked except SMTP and DNS. Block all services that listen TCP connections in high port numbers. X-windows (port 6000+), OpenWindows (port 2000+) are few candidates. NFS (port 2049) runs usually over UDP, but it can be run over TCP, so you have better block it. Incoming connections from port 20 into high port numbers are supposed to be FTP data connections. Access-list 2 limits access to router itself (telnet & SNMP) All UDP traffic is blocked to protect RPC services Shortcomings You cannot enforce strong access policies with router access lists. Users can easily install backdoors to their systems to get over "no incoming telnet" or "no X" rules. Also crackers install telnet backdoors on systems where they break in. You can never be sure what services you have listening connections on high port numbers. Checking source port on incoming FTP data connections is a weak security method. It also breaks access to some FTP sites. It makes users more difficult to use their backdoors, but doesn't prevent bad guys from scanning your systems. Use at least Cisco version 9.21 so you can filter incoming packets and check for address spoofing. It's still better to use 10.3, where you get some extra features (like filtering on source port) and some improvements on filter syntax. You have still a few ways to make your setup stronger. Block all incoming TCP-connections and tell users to use passive-FTP clients. You can also block outgoing ICMP echo-reply and destination-unreachable messages to hide your network and to prevent use of network scanners. Cisco.com use to have an archive of examples for building firewalls using Cisco routers, but it doesn't seem to be online anymore. There are some notes on Cisco access control lists, at least, at . What are the critical resources in a firewall? It's important to understand the critical resources of your firewall architecture, so when you do capacity planning, performance optimizations, etc., you know exactly what you need to do, and how much you need to do it in order to get the desired result. What exatly the firewall's critical resources are tends to vary from site to site, depending on the sort of traffic that loads the system. Some people think they'll automatically be able to increase the data throughput of their firewall by putting in a box with a faster CPU, or another CPU, when this isn't necessarily the case. Potentially, this could be a large waste of money that doesn't do anything to solve the problem at hand or provide the expected scalability. On busy systems, memory is extremely important. You have to have enough RAM to support every instance of every program necessary to service the load placed on that machine. Otherwise, the swapping will start, and the productivity will stop. Light swapping isn't usually much of a problem, but if a system's swap space begins to get busy, then it's usually time for more RAM. A system that's heavily swapping is often relatively easy to push over the edge in a denial-of-service attack, or simply fall behind in processing the load placed on it. This is where long email delays start. Beyond the system's requirement for memory, it's useful to understand that different services use different system resources. So the configuration that you have for your system should be indicative of the kind of load you plan to service. A 700 MHz processor isn't going to do you much good if all you're doing is netnews and mail, and are trying to do it on an IDE disk with an ISA controller. Critical Resources for Firewall Services Service Critical Resource Email Disk I/O NetNews Disk I/O Web Host OS Socket Performance IP Routing Host OS Socket Performance Web Cache Host OS Socket Performance, Disk I/O What is a DMZ, and why do I want one? "DMZ" is an abbreviation for "demilitarized zone". In the context of firewalls, this refers to a part of the network that is neither part of the internal network nor directly part of the Internet. Typically, this is the area between your Internet access router A DMZ can be created by putting access control lists on your access router. This minimizes the exposure of hosts on your external LAN by allowing only recognized and managed services on those hosts to be accessible by hosts on the Internet. For example, a web server running on NT might be vulnerable to a number of denial-of-service attacks against such services as NetBIOS and SMB. These services are not required for the operation of a web server, so blocking TCP connections to ports 135 and 139 on that host will reduce the exposure to a denial-of-service attack. In fact, if you block everything but HTTP traffic to that host, an attacker will only have one service to attack. How might I increase the security and scalability of my DMZ? A common approach for an attacker is to break into a host that's vulnerable to attack, and exploit trust relationships between the vulnerable host and more interesting targets. If you are running a number of services that have different levels of security, you might want to consider breaking your DMZ into several "security zones". This can be done by having a number of different networks within the DMZ. For example, the access router could feed two ethernets, both protected by ACLs, and therefore in the DMZ. On one of the ethernets, you might have hosts whose purpose is to service your organization's need for Internet connectivity. These will likely relay mail, news, and host DNS. On the other ethernet could be your web server(s) and other hosts that provide services for the benefit of Internet users. In many organizations, services for Internet users tend to be less carefully guarded and are more likely to be doing insecure things. (For example, in the case of a web server, unauthenticated and untrusted users might be running CGI or other executable programs. This might be reasonable for your web server, but brings with it a certain set of risks that need to be managed. It is likely these services are too risky for an organization to run them on a bastion host, where a slip-up can result in the complete failure of the security mechanisms.) By putting hosts with similar levels of risk on networks together in the DMZ, you can help minimize the effect of a breakin at your site. If someone breaks into your web server by exploiting some bug in your web server, they'll not be able to use it as a launching point to break into your private network if the web servers are on a seperate LAN from the bastion hosts, and you don't have any trust relationships between the web server and bastion host. Now, keep in mind that we're running ethernet here. If someone breaks into your web server, and your bastion host is on the same ethernet, an attacker can install a sniffer on your web server, and watch the traffic to and from your bastion host. This might reveal things that can be used to break into the bastion host and gain access to the internal network. Splitting services up not only by host, but by network, and limiting the level of trust between hosts on those networks, you can greatly reduce the liklihood of a breakin on one host being used to break into the other. Succinctly stated: breaking into the web server in this case won't make it any easier to break into the bastion host. You can also increase the scalability of your architecture by placing hosts on different networks. The fewer machines that there are to share the available bandwidth, the more bandwidth that each will get. What is a `single point of failure', and how do I avoid having one? An architecture whose security hinges upon one mechanism has a single point of failure. Software that runs bastion hosts has bugs. Applications have bugs. Software that controls routers has bugs. It makes sense to use all of these components to build a securely designed network, and to use them in redundant ways. If your firewall architecture is a screened subnet, you have two packet filtering routers and a bastion host. (See question 2 from this section.) Your Internet access router will not permit traffic from the Internet to get all the way into your private network. However, if you don't enforce that rule with any other mechanisms on the bastion host and/or choke router, only one component of your architecture needs to fail or be compromised in order to get inside. On the other hand, if you have a redundant rule on the bastion host, and again on the choke router, an attacker will need to defeat three mechanisms. Further, if the bastion host or the choke router needs to invoke its rule to block outside access to the internal network, you might want to have it trigger an alarm of some sort, since you know that someone has gotten through your access router. How can I block all of the bad stuff? For firewalls where the emphasis is on security instead of connectivity, you should consider blocking everything by default, and only specifically allowing what services you need on a case-by-case basis. If you block everything, except a specific set of services, then you've already made your job much easier. Instead of having to worry about every security problem with everything product and service around, you only need to worry about every security problem with a specific set of services and products. :-) Before turning on a service, you should consider a couple of questions: Is the protocol for this product a well-known, published protocol? Is the application to service this protocol available for public inspection of its implementation? How well known is the service and product? How does allowin