Internet Firewalls: Frequently Asked Questions: Paul D. Robertson Matt Curtin Marcus J. Ranum
Internet Firewalls: Frequently Asked Questions: Paul D. Robertson Matt Curtin Marcus J. Ranum
http://www.interhack.net/pubs/fwfaq/
Contents
1 Administrativia 1.1 About the FAQ 1.2 For Whom Is the FAQ Written? 1.3 Before Sending Mail 1.4 Where Can I nd the Current Version of the FAQ? 1.5 Where Can I Find Non-English Versions of the FAQ? 1.6 Contributors 1.7 Copyright and Usage 2 Background and Firewall Basics 2.1 What is a network rewall? 2.2 Why would I want a rewall? 2.3 What can a rewall protect against? 2.4 What can't a rewall protect against? 2.5 What about viruses and other malware? 2.6 Will IPSEC make rewalls obsolete? 2.7 What are good sources of print information on rewalls? 2.8 Where can I get more information on rewalls on the Internet? 3 Design and Implementation Issues 3.1 What are some of the basic design decisions in a rewall? 3.2 What are the basic types of rewalls? 3.3 What are proxy servers and how do they work? 3.4 What are some cheap packet screening tools? 3.5 What are some reasonable ltering rules for a kernel-based packet screen? 3.6 What are some reasonable ltering rules for a Cisco? 3.7 What are the critical resources in a rewall? 3.8 What is a DMZ, and why do I want one? 3.9 How might I increase the security and scalability of my DMZ?
1 de 44 30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
3.10 What is a `single point of failure', and how do I avoid having one? 3.11 How can I block all of the bad stu? 3.12 How can I restrict web access so users can't view sites unrelated to work? 4 Various Attacks 4.1 What is source routed trac and why is it a threat? 4.2 What are ICMP redirects and redirect bombs? 4.3 What about denial of service? 4.4 What are some common attacks, and how can I protect my system against them? 5 How Do I... 5.1 Do I really want to allow everything that my users ask for? 5.2 How do I make Web/HTTP work through my rewall? 5.3 How do I make SSL work through the rewall? 5.4 How do I make DNS work with a rewall? 5.5 How do I make FTP work through my rewall? 5.6 How do I make Telnet work through my rewall? 5.7 How do I make Finger and whois work through my rewall? 5.8 How do I make gopher, archie, and other services work through my rewall? 5.9 What are the issues about X11 through a rewall? 5.10 How do I make RealAudio work through my rewall? 5.11 How do I make my web server act as a front-end for a database that lives on my private network? 5.12 But my database has an integrated web server, and I want to use that. Can't I just poke a hole in the rewall and tunnel that port? 5.13 How Do I Make IP Multicast Work With My Firewall? 6 TCP and UDP Ports 6.1 What is a port? 6.2 How do I know which application uses what port? 6.3 What are LISTENING ports? 6.4 How do I determine what service the port is for? 6.5 What ports are safe to pass through a rewall? 6.6 The behavior of FTP 6.7 What software uses what FTP mode? 6.8 Is my rewall trying to connect outside? 6.9 The anatomy of a TCP connection A. Some Commercial Products and Vendors B. Glossary of Firewall-Related Terms Bibliography
1 Administrativia
2 de 44 30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
http://www.interhack.net/pubs/fwfaq/
The provider of the software you're using. The provider of the hardware ``appliance'' you're using. The provider of the network service you're using. That is, if you're on AOL, ask them. If you're trying to use something on a corporate network, talk to your system administrator.
Posted versions are 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.
1.6 Contributors
Many people have written helpful suggestions and thoughtful commentary. We're grateful to all contributors. We'd like to thank afew by name: Keinanen Vesa, Allen Leibowitz, Brent Chapman, Brian Boyle, D. Clyde Williamson, Richard Reiner, Humberto Ortiz Zuazaga, Theodore Hope, and Patrick Darden.
4 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
to other languages are also explicitly allowed. Translators may add their names to the ``Contributors'' section.
5 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
these systems have become important parts of the Internet service structure (e.g., UUnet.uu.net, whitehouse.gov, gatekeeper.dec.com) and have reected well on their organizational sponsors. Note that while this is historically true, most organizations now place public information on a Web server, often protected by a rewall, but not normally on the rewall itself.
6 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
wooden house, but there are a lot of organizations out there buying expensive rewalls and neglecting the numerous other back-doors into their network. For a rewall to work, it must be a part of a consistent overall organizational security architecture. Firewall policies must be realistic and reect the level of security in the entire network. For example, a site with top secret or classied data doesn't need a rewall at all: they shouldn't be hooking up to the Internet in the rst place, or the systems with the really secret data should be isolated from the rest of the corporate network. Lost or stolen PDAs, laptops, cell phones, USB keys, external hard drives, CDs, DVDs, etc. For protection against this type of data loss, you will need a good policy, encryption, and some sort of enterprise auditing/enforcement. Places that really care about Intellectual Property (IP) and data loss prevention use USB rewalling technology on their desktops and systems in public areas. The details are outside the scope of this FAQ. Badly written, pooly thought out, or non-existent organizational policy. A rewall is the end extension of an organization's security policy. If that policy is ill-informed, pooly formed, or not formed at all, then the state of the rewall is likely to be similar. Executive buy-in is key to good security practice, as is the complete and unbiased enforcement of your policies. Firewalls can't protect against political exceptions to the policy, so these must be documented and kept at a miniumum. Another thing a rewall can't really protect you against is traitors or idiots inside your network. While an industrial spy might export information through your rewall, he's just as likely to export it through a telephone, FAX machine, or Compact Disc. CDs are a far more likely means for information to leak from your organization than a rewall. 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 rewall, if he can nd a ``helpful'' employee inside who can be fooled into giving access to a modem pool or desktop through a "remote support" type portal. Before deciding this isn't a problem in your organization, ask yourself how much trouble a contractor has getting logged into the network or how much diculty a user who forgot his password has getting it reset. If the people on the help desk believe that every call is internal, you have a problem that can't be xed by tightening controls on the rewalls. Firewalls can't protect against tunneling over most application protocols to trojaned or poorly written clients. There are no magic bullets and a rewall is not an excuse to not implement software controls on internal networks or ignore host security on servers. Tunneling ``bad'' things over HTTP SMTP and other protocols is quite , , simple and trivially demonstrated. Security isn't ``re and forget''. Lastly, rewalls can't protect against bad things being allowed through them. For instance, many Trojan Horses use the Internet Relay Chat (IRC) protocol to allow an attacker to control a compromised internal host from a public IRC server. If you allow any internal system to connect to any external system, then your rewall will provide no protection from this vector of attack.
7 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
8 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
expertise are more likely to produce software that can be fooled. Further consideration of this topic would be worthwhile [3], but is beyond the scope of this document.
9 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
1-56592-871-7 Firewalls and Internet Security: Repelling the Wily Hacker Authors Bill Cheswick, Steve Bellovin, Avi Rubin Publisher Addison Wesley Edition 2003 ISBN 020163466X Practical Internet & Unix Security Authors Simson Garnkel and Gene Spaord Publisher O'Reilly Edition 1996 ISBN 1-56592-148-8 Note Discusses primarily host security. Related references are: Internetworking with TCP/IP Vols I, 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. Volume I (on principles, protocols and architecture) is readable by everyone. Volume 2 (on design, implementation and internals) is more technical. Volume 3 covers client-server computing. Unix System Security--A Guide for Users and System Administrators Author David Curry Publisher Addison Wesley Edition 1992 ISBN 0-201-56327-4
10 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
11 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
established the acceptable risk level (i.e., how paranoid you are) by resolving the rst issue, you can form a checklist of what should be monitored, permitted, and denied. In other words, you start by guring out your overall objectives, and then combine a needs analysis with a risk assessment, and sort the almost always conicting requirements out into a laundry list that species what you plan to implement. The third issue is nancial. 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 rewall product may cost between $100,000 at the high end, and free at the low end. The free option, of doing some fancy conguring on a Cisco or similar router will cost nothing but sta time and a few cups of coee. Implementing a high end rewall from scratch might cost several man-months, which may equate to $30,000 worth of sta salary and benets. The systems management overhead is also a consideration. Building a home-brew is ne, but it's important to build it so that it doesn't require constant (and expensive) attention. It's important, in other words, to evaluate rewalls 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 trac routing service placed between the network service provider's router and your internal network. The trac 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 lter, permitting communication with one or more internal machines. There are benets and drawbacks to both approaches, with the proxy machine providing a greater level of audit and, potentially, security in return for increased cost in conguration 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-o between ease-of-use and security comes back to haunt us with a vengeance.
http://www.interhack.net/pubs/fwfaq/
application. The important thing to recognize is that the lower-level the forwarding mechanism, the less examination the rewall can perform. Generally speaking, lower-level rewalls are faster, but are easier to fool into doing the wrong thing. These days, most rewalls fall into the ``hybrid'' category, which do network ltering as well as some amount of application inspection. The amount changes depending on the vendor, product, protocol and version, so some level of digging and/or testing is often necessary.
Figure 1: Screened Host Firewall In Figure 1, a network layer rewall called a ``screened host rewall'' is represented. In a screened host rewall, access to and from a single host is controlled by means of a router operating at a network layer. The single host is a bastion host; a highlydefended and secured strong-point that (hopefully) can resist attack.
13 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
Figure 2: Screened Subnet Firewall Example Network layer rewall: In Figure 2, a network layer rewall called a ``screened subnet rewall'' is represented. In a screened subnet rewall, access to and from a whole network is controlled by means of a router operating at a network layer. It is similar to a screened host, except that it is, eectively, a network of screened hosts.
14 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
Figure 3: Dual Homed Gateway Example Application layer rewall: In Figure 3, an application layer rewall 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 trac passing through it. Most rewalls now lie someplace between network layer rewalls and application layer rewalls. As expected, network layer rewalls have become increasingly ``aware'' of the information going through them, and application layer rewalls have become increasingly ``low level'' and transparent. The end result is that now there are fast packet-screening systems that log and audit data as they pass through the system. Increasingly, rewalls (network and application layer) incorporate encryption so that they may protect trac 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 snied. (IPSEC, described in Section 2.6, is playing an increasingly signicant role in the construction of such virtual private networks.)
http://www.interhack.net/pubs/fwfaq/
Window System, 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 rewall. Its advantage is that it's easy to use, but it doesn't support the addition of authentication hooks or protocol specic logging. For more information on SOCKS, see http://www.socks.nec.com/.
3.5 What are some reasonable ltering rules for a kernel-based packet screen?
This example is written specically for ipfwadm on Linux, but the principles (and even much of the syntax) applies for other kernel interfaces for packet screening on ``open source'' Unix systems. There are four basic categories covered by the ipfwadm rules: -A -I -O -F Packet Accounting Input rewall Output rewall Forwarding rewall ipfwadm also has masquerading (-M) capabilities. For more information on switches and options, see the ipfwadm man page.
3.5.1 Implementation
Here, our organization is using a private (RFC 1918) Class C network 192.168.1.0. Our ISP has assigned us the address 201.123.102.32 for our gateway's external interface and 201.123.102.33 for our external mail server. Organizational policy says:
16 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
Allow all outgoing TCP connections Allow incoming SMTP and DNS to external mail server Block all other trac The following block of commands can be placed in a system boot le (perhaps on Unix systems).
ipfwadm ipfwadm ipfwadm ipfwadm ipfwadm ipfwadm -F -F -F -F -F -F -f -p -i -i -i -a deny m -b m -b m -b m -S rc.local
-P tcp -S 0.0.0.0/0 1024:65535 -P tcp -S 0.0.0.0/0 1024:65535 -P udp -S 0.0.0.0/0 1024:65535 192.168.1.0/24 -D 0.0.0.0/0 -W
3.5.2 Explanation
Line one ushes (-f) all forwarding (-F) rules. Line two sets the default policy (-p) to deny. Lines three through ve are input rules (-i) in the following format: ipfwadm -F (forward) -i (input) m (masq.) -b (bi-directional) -P protocol) [protocol]-S (source)[subnet/mask] [originating ports]-D (destination) [subnet/mask][port] Line six appends (-a) a rule that permits all internal IP addresses out to all external addresses on all protocols, all ports. Line eight adds a route so that trac going to 201.123.102.33 will be directed to the internal address 192.168.1.2.
17 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
Figure 4: Packet Filtering Router 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.
3.6.1 Implementation
Allow all outgoing TCP-connections Allow incoming SMTP and DNS to mailhost Allow incoming FTP data connections to high TCP port ( Try to protect services that live on high port numbers Only incoming packets from Internet are checked in this conguration. Rules are tested in order and stop when the rst match is found. There is an implicit deny rule at the end of an access list that denies everything. This IP access list 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 no ip directed-broadcast ! interface serial 0 no ip directed-broadcast ip access-group 101 in ! access-list 101 deny ip 127.0.0.0 0.255.255.255 any access-list 101 deny ip 10.0.0.0 0.255.255.255 any access-list 101 deny ip 172.16.0.0 0.15.255.255 any access-list 101 deny ip 192.168.0.0 0.0.255.255 any access-list 101 deny ip any 0.0.0.255 255.255.255.0 access-list 101 deny ip any 0.0.0.0 255.255.255.0 ! 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 !
1024)
18 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
3.6.2 Explanations
Drop all source-routed packets. Source routing can be used for address spoong. Drop directed broadcasts, which are used in smurf attacks. If an incoming packet claims to be from a local net, loopback network, or private network, 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 for TCP connections on high port numbers. X11 (port 6000+), OpenWindows (port 2000+) are a few candidates. NFS (port 2049) runs usually over UDP but it can be run over TCP so you should 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 trac is blocked to protect RPC services
3.6.3 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 X11'' rules. Also crackers install telnet backdoors on systems where they break in. You can never be sure what services you have listening for connections on high port numbers. (You can't be sure of what services you have listening for connections on low port numbers, either, especially in highly decentralized environments where people can put their own machines on the network or where they can get administrative access to their own machines.) Checking the source port on incoming FTP data connections is a weak security method. It also breaks access to some FTP sites. It makes use of the service more dicult for users without preventing bad guys from scanning your systems. Use at least Cisco version 9.21 so you can lter incoming packets and check for address spoong. It's still better to use 10.3, where you get some extra features (like ltering on source port) and some improvements on lter 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
19 de 44 30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
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 rewalls using Cisco routers, but it doesn't seem to be online anymore. There are some notes on Cisco access control lists, at least, at ftp://ftp.cisco.com/pub/mibs /app_notes/access-lists.
Table 1: Critical Resources for Firewall Services Service Email Netnews Web Critical Resource Disk I/O Disk I/O Host OS Socket Performance
IP Routing Host OS Socket Performance Web Cache Host OS Socket Performance, Disk I/O
20 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
http://www.interhack.net/pubs/fwfaq/
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 eect 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 separate 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 this is Ethernet. If someone breaks into your web server, and your bastion host is on the same Ethernet, an attacker can install a snier on your web server, and watch the trac 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. (Switched Ethernet can reduce your exposure to this kind of problem, but will not eliminate it.) 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 likelihood 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 dierent networks. The fewer machines that there are to share the available bandwidth, the more bandwidth that each will get.
3.10 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 rewall architecture is a screened subnet, you have two packet ltering routers and a bastion host. (See question 3.2 from this section.) Your Internet access router will not permit trac 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.
22 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
3.12 How can I restrict web access so users can't view sites unrelated to work?
A few years ago, someone got the idea that it's a good idea to block ``bad'' web sites, i.e., those that contain material that The Company views ``inappropriate''. The idea has been increasing in popularity, but there are several things to consider when thinking about implementing such controls in your rewall. It is not possible to practically block everything that an employer deems ``inappropriate''. The Internet is full of every sort of material. Blocking one source will only redirect trac to another source of such material, or cause someone to gure a way around the block. Most organizations do not have a standard for judging the appropriateness of
23 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
material that their employees bring to work, e.g., books and magazines. Do you inspect everyone's briefcase for ``inappropriate material'' every day? If you do not, then why would you inspect every packet for ``inappropriate material''? Any decisions along those lines in such an organization will be arbitrary. Attempting to take disciplinary action against an employee where the only standard is arbitrary typically isn't wise, for reasons well beyond the scope of this document. Products that perform site-blocking, commercial and otherwise, are typically easy to circumvent. Hostnames can be rewritten as IP addresses. IP addresses can be written as a 32-bit integer value, or as four 8-bit integers (the most common form). Other possibilities exist, as well. Connections can be proxied. Web pages can be fetched via email. You can't block them all. The eort that you'll spend trying to implement and manage such controls will almost certainly far exceed any level of damage control that you're hoping to have. The rule-of-thumb to remember here is that you cannot solve social problems with technology. If there is a problem with someone going to an ``inappropriate'' web site, that is because someone else saw it and was oended by what he saw, or because that person's productivity is below expectations. In either case, those are matters for the personnel department, not the rewall administrator.
4 Various Attacks
4.1 What is source routed trac and why is it a threat?
Normally, the route a packet takes from its source to its destination is determined by the routers between the source and destination. The packet itself only says where it wants to go (the destination address), and nothing about how it expects to get there. There is an optional way for the sender of a packet (the source) to include information in the packet that tells the route the packet should take to get to its destination; thus the name ``source routing''. For a rewall, source routing is noteworthy, since an attacker can generate trac claiming to be from a system ``inside'' the rewall. In general, such trac wouldn't route to the rewall properly, but with the source routing option, all the routers between the attacker's machine and the target will return trac along the reverse path of the source route. Implementing such an attack is quite easy; so rewall builders should not discount it as unlikely to happen. In practice, source routing is very little used. In fact, generally the main legitimate use is in debugging network problems or routing trac over specic links for congestion control for specialized situations. When building a rewall, source routing should be blocked at some point. Most commercial routers incorporate the ability to block source routing specically, and many versions of Unix that might be used to build rewall bastion hosts have the ability to disable or to ignore source routed trac.
24 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
25 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
4.4 What are some common attacks, and how can I protect my system against them?
Each site is a little dierent from every other in terms of what attacks are likely to be used against it. Some recurring themes do arise, though.
26 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
5 How Do I...
5.1 Do I really want to allow everything that my users ask for?
It's entirely possible that the answer is ``no''. Each site has its own policies about what is and isn't needed, but it's important to remember that a large part of the job of being an organization's gatekeeper is education. Users want streaming video, real-time chat, and to be able to oer services to external customers that require interaction with live databases on the internal network. That doesn't mean that any of these things can be done without presenting more risk to the organization than the supposed ``value'' of heading down that road is worth. Most users don't want to put their organization at risk. They just read the trade rags, see advertisements, and they want to do those things, too. It's important to look into what it is that they really want to do, and to help them understand how they might be able to accomplish their real objective in a more secure manner. You won't always be popular, and you might even nd yourself being given direction to do something incredibly stupid, like ``just open up ports foo through bar''. If that happens, don't worry about it. It would be wise to keep all of your exchanges on such an event so that when a 12-year-old script kiddie breaks in, you'll at least be able to separate yourself from the whole mess.
27 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
SSL is a protocol that allows secure connections across the Internet. Typically, SSL is used to protect HTTP trac. However, other protocols (such as telnet) can run atop SSL. Enabling SSL through your rewall can be done the same way that you would allow HTTP trac, if it's HTTP that you're using SSL to secure, which is usually true. The only dierence is that instead of using something that will simply relay HTTP you'll , need something that can tunnel SSL. This is a feature present on most web object caches.
6 You can nd out more about SSL from Netscape .
28 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
An internal client asking about an internal host asks the internal server, and gets an answer; an internal client asking about an external host asks the internal server, which asks the public server, which asks the Internet, and the answer is relayed back. A client on the public server works just the same way. An external client, however, asking about an internal host gets back the ``restricted'' answer from the public server. This approach assumes that there's a packet ltering rewall between these two servers that will allow them to talk DNS to each other, but otherwise restricts DNS between other hosts. Another trick that's useful in this scheme is to employ wildcard PTR records in your IN-ADDR.ARPA domains. These cause an an address-to-name lookup for any of your non-public hosts to return something like ``unknown.YOUR.DOMAIN'' rather than an error. This satises anonymous FTP sites like ftp.uu.net that insist on having a name for the machines they talk to. This may fail when talking to sites that do a DNS cross-check in which the host name is matched against its address and vice versa.
http://www.interhack.net/pubs/fwfaq/
something like the ``established'' screening rules. Application proxies could be in the form of a standalone proxy running on the bastion host, or in the form of a SOCKS server and a modied client.
5.8 How do I make gopher, archie, and other services work through my rewall?
The majority of rewall administrators choose to support gopher and archie through web proxies, instead of directly. Proxies such as the rewall toolkit's http-gw convert gopher/gopher+ queries into HTML and vice versa. For supporting archie and other queries, many sites rely on Internet-based Web-to-archie servers, such as ArchiePlex. The Web's tendency to make everything on the Internet look like a web service is both a blessing and a curse. There are many new services constantly cropping up. Often they are misdesigned or are not designed with security in mind, and their designers will cheerfully tell you if you want to use them you need to let port xxx through your router. Unfortunately, not everyone can do that, and so a number of interesting new toys are dicult to use for people behind rewalls. Things like RealAudio, which require direct UDP access, are particularly egregious examples. The thing to bear in mind if you nd yourself faced with one of these problems is to nd out as much as you can about the security risks that the service may present, before you just allow it through. It's quite possible the service has no security implications. It's equally possible that it has undiscovered holes you could drive a truck through.
30 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
5.11 How do I make my web server act as a front-end for a database that lives on my private network?
The best way to do this is to allow very limited connectivity between your web server and your database server via a specic protocol that only supports the level of functionality you're going to use. Allowing raw SQL, or anything else where custom extractions could be performed by an attacker isn't generally a good idea. Assume that an attacker is going to be able to break into your web server, and make queries in the same way that the web server can. Is there a mechanism for extracting sensitive information that the web server doesn't need, like credit card information? Can an attacker issue an SQL select and extract your entire proprietary database? ``E-commerce'' applications, like everything else, are best designed with security in mind from the ground up, instead of having security ``added'' as an afterthought. Review your architecture critically, from the perspective of an attacker. Assume that the attacker knows everything about your architecture. Now ask yourself what needs
31 de 44 30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
to be done to steal your data, to make unauthorized changes, or to do anything else that you don't want done. You might nd that you can signicantly increase security without decreasing functionality by making a few design and implementation decisions. Some ideas for how to handle this: Extract the data you need from the database on a regular basis so you're not making queries against the full database, complete with information that attackers will nd interesting. Greatly restrict and audit what you do allow between the web server and database.
5.12 But my database has an integrated web server, and I want to use that. Can't I just poke a hole in the rewall and tunnel that port?
If your site rewall policy is suciently lax that you're willing to manage the risk that someone will exploit a vulnerability in your web server that will result in partial or complete exposure of your database, then there isn't much preventing you from doing this. However, in many organizations, the people who are responsible for tying the web front end to the database back end simply do not have the authority to take that responsibility. Further, if the information in the database is about people, you might nd yourself guilty of breaking a number of laws if you haven't taken reasonable precautions to prevent the system from being abused. In general, this isn't a good idea. See question 5.11 for some ideas on other ways to accomplish this objective.
32 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
routing. The role of the rewall in multicast routing, conceptually, is no dierent from its role in other trac routing. That is, a policy that identies which multicast groups are and aren't allowed must be dened and then a system of allowing that trac according to policy must be devised. Great detail on how exactly to do this is beyond the scope of this document. Fortunately, RFC 2588 [4] discusses the subject in more detail. Unless your rewall product supports some means of selective multicast forwarding or you have the ability to put it in yourself, you might nd forwarding multicast trac in a way consistent with your security policy to be a bigger headache than it's worth.
33 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
a server port). However, any port may be used as a server port, and any port may be used as an ``outgoing'' port. So, to sum it up, here's what happens in a basic connection: At some point in time, a server application on host 1.2.3.4 decides to ``listen'' at port 80 (HTTP) for new connections. You (5.6.7.8) want to surf to 1.2.3.4, port 80, and your browser issues a connect call to it. The connect call, realising that it doesn't yet have local port number, goes hunting for one. The local port number is necessary since when the replies come back some time in the future, your TCP/IP stack will have to know to what application to pass the reply. It does this by remembering what application uses which local port number. (This is grossly simplied, no ames from programmers, please.) Your TCP stack nds an unused dynamic port, usually somewhere above 1024. Let's assume that it nds 1029. Your rst packet is then sent, from your local IP 5.6.7.8, port 1029, to 1.2.3.4, , port 80. The server responds with a packet from 1.2.3.4, port 80, to you, 5.6.7.8, port 1029. This procedure is actually longer than this, read on for a more in-depth explanation of TCP connect sequences.
34 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
Wait, what's happening? Has my workstation stolen my VISA number and decided to go play blackjack with some rogue server on the internet? And what's that software that BBN has installed? This is NOT where you start panicking and send mail to the rewalls list. In fact, this question has been asked maybe a dozen times during the past six months, and every time it's been answered. Not that THAT keeps people from asking the same question again. If you are asking this question, you are most likely using a windows box. The ports you are seeing are (most likely) two listening ports that the RPC subsystem opens when it starts up. This is an example of where dynamicly assigned ports may be used by server processes. Applications using RPC will later on connect to port 135 (the netbios ``portmapper'') to query where to nd some RPC service, and get an answer back saying that that particular service may be contacted on port 1025. Now, how do we know this, since there's no ``list'' describing these ports? Simple: There's no substitute for experience. And using the mailing list search engines also helps a hell of a lot.
35 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
sockets layer and dynamically remembers which process opens which port. The drawback of this approach is that it can't tell you what ports were opened before inzider started, but it's the best that you'll get on windows (to my knowledge). http://ntsecurity.nu/toolbox/inzider/.
This is more of an application security issue rather than a rewall security issue. One could argue that a rewall should stop all possible attacks, but with the number of new network protocols, NOT designed with security in mind, and networked applications, neither designed with security in mind, it becomes impossible for a rewall to protect against all data-driven attacks.
36 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
Or, ``Why do I have to open all ports above 1024 to my FTP server?'' FTP doesn't really look a whole lot like other applications from a networking perspective. It keeps one listening port, port 21, which users connect to. All it does is let people log on, and establish ANOTHER connection to do actual data transfers. This second connection is usually on some port above 1024. There are two modes, ``active'' (normal) and ``passive'' mode. This word describes the server's behaviour. In active mode, the client (5.6.7.8) connects to port 21 on the server (1.2.3.4) and logs on. When le transfers are due, the client allocates a dynamic port above 1024, informs the server about which port it opened, and then the server opens a new connection to that port. This is the ``active'' role of the server: it actively establishes new connections to the client. In passive mode, the connection to port 21 is the same. When le transfers are due, the SERVER allocates a dynamic port above 1024, informs the client about which port it opened, and then the CLIENT opens a new connection to that port. This is the ``passive'' role of the server: it waits for the client to establish the second (data) connection. If your rewall doesn't inspect the application data of the FTP command connection, it won't know that it needs to dynamically open new ports above 1024. On a side note: The traditional behaviour of FTP servers in active mode is to establish the data session FROM port 20, and to the dynamic port on the client. FTP servers are steering away from this behaviour somewhat due to the need to run as ``root'' on unix systems in order to be able to allocate ports below 1024. Running as ``root'' is not good for security, since if there's a bug in the software, the attacker would be able to compromise the entire machine. The same goes for running as ``Administrator'' or ``SYSTEM'' (``LocalSystem'') on NT machines, although the low port problem does not apply on NT. To sum it up, if your rewall understands FTP it'll be able to handle the data , connections by itself, and you won't have to worry about ports above 1024. If it does NOT, there are four issues that you need to address: Firewalling an FTP server in active mode You need to let your server open new connections to the outside world on ports 1024 and above Firewalling an FTP server in passive mode You need to let the outside world connect to ports 1024 and above on your server. CAUTION!!!! There may be applications running on some of these ports that you do NOT want outside people using. Disallow access to these ports before allowing access to the 1024-65535 port range. Firewalling FTP clients in active mode You need to let the outside world connect to ports 1024 and above on your clients. CAUTION!!!! There may be applications running on some of these ports
37 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
that you do NOT want outside people using. Disallow access to these ports before allowing access to the 1024-65535 port range. Firewalling FTP clients in passive mode You need to let your clients open new connections to the outside world on ports 1024 and above. Again, if your rewall understands FTP none of the four points above apply to you. , Let the rewall do the job for you.
38 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
``Acknowledge'' a previous packet URG ``Urgent'' data which needs to be processed immediately In this example, your client is 5.6.7.8, and the port assigned to you dynamically is 1049. The server is 1.2.3.4, port 80. You begin the connection attempt:
5.6.7.8:1049 -> 1.2.3.4:80 SYN=ON
The server receives this packet and understands that someone wants to form a new connection. A response is sent:
1.2.3.4:80 -> 5.6.7.8:1049 SYN=ON ACK=ON
The client receives the response, and informs that the response is received
5.6.7.8:1049 -> 1.2.3.4:80 ACK=ON
Here, the connection is opened. This is called a three-way handshake. Its purpose is to verify to BOTH hosts that they have a working connection between them. The internet being what it is, unreliable and ooded, there are provisions to compensate for packet loss. If the client sends out the initial SYN without receiving a SYN+ACK within a few seconds, it'll resend the SYN. If the server sends out the SYN+ACK without receiving an ACK in a few seconds, it'll resend the SYN+ACK packet. The latter is actually the reason that SYN ooding works so well. If you send out SYN packets from lots of dierent ports, this will tie up a lot of resources on the server. If you also refuse to respond to the returned SYN+ACK packets, the server will KEEP these connections for a long time, resending the SYN+ACK packets. Some servers will not accept new connections while there are enough connections currently
39 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
forming; this is why SYN ooding works. All packets transmitted in either direction after the three-way handshake will have the ACK bit set. Stateless packet lters make use of this in the so called ``established'' lters: They will only let packets through that have the ACK bit set. This way, no packet may pass through in a certain direction that could form a new connection. Typically, you don't allow outside hosts to open new connections to inside hosts by requiring the ACK bit set on these packets. When the time has come to close the connection, there are two ways of doing it: Using the FIN ag, or using the RST ag. Using FIN ags, both implementations are required to send out FIN ags to indicate that they want to close the connection, and then send out acknowledgements to these FINs, indicating that they understood that the other end wants to close the connection. When sending out RST's, the connection is closed forcefully, and you don't really get an indication of whether the other end understood your reset order, or that it has in fact received all data that you sent to it. The FIN way of closing the connection also exposes you to a denial-of-service situation, since the TCP stack needs to remember the closed connection for a fairly long time, in case the other end hasn't received one of the FIN packets. If suciently many connections are opened and closed, you may end up having ``closed'' connections in all your connection slots. This way, you wouldn't be able to dynamically allocate more connections, seeing that they're all used. Dierent OSes handle this situation dierently.
http://www.interhack.net/pubs/fwfaq/
your rst line of defense against attackers from the outside Internet. By enabling access control lists on this router, you'll be able to provide a level of protection for all of the hosts ``behind'' that router, eectively making that network a DMZ instead of an unprotected external LAN. Application-Layer Firewall A rewall system in which service is provided by processes that maintain complete TCP connection state and sequencing. Application layer rewalls often re-address trac so that outgoing trac appears to have originated from the rewall, rather than the internal host. Authentication The process of determining the identity of a user that is attempting to access a system. Authentication Token A portable device used for authenticating a user. Authentication tokens operate by challenge/response, time-based code sequences, or other techniques. This may include paper-based lists of one-time passwords. Authorization The process of determining what types of activities are permitted. Usually, authorization is in the context of authentication: once you have authenticated a user, they may be authorized dierent types of access or activity. Bastion Host A system that has been hardened to resist attack, and which is installed on a network in such a way that it is expected to potentially come under attack. Bastion hosts are often components of rewalls, or may be ``outside'' web servers or public access systems. Generally, a bastion host is running some form of general purpose operating system (e.g., Unix, VMS, NT, etc.) rather than a ROM-based or rmware operating system. Challenge/Response An authentication technique whereby a server sends an unpredictable challenge to the user, who computes a response using some form of authentication token. Chroot A technique under Unix whereby a process is permanently restricted to an isolated subset of the lesystem. Cryptographic Checksum A one-way function applied to a le to produce a unique ``ngerprint'' of the le for later reference. Checksum systems are a primary means of detecting lesystem tampering on Unix. Data Driven Attack A form of attack in which the attack is encoded in innocuous-seeming data which is executed by a user or other software to implement an attack. In the case of rewalls, a data driven attack is a concern since it may get through the rewall in data form and launch an attack against a system behind the rewall.
41 de 44
30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
Defense in Depth The security approach whereby each system on the network is secured to the greatest possible degree. May be used in conjunction with rewalls. DNS spoong Assuming the DNS name of another system by either corrupting the name service cache of a victim system, or by compromising a domain name server for a valid domain. Dual Homed Gateway A dual homed gateway is a system that has two or more network interfaces, each of which is connected to a dierent network. In rewall congurations, a dual homed gateway usually acts to block or lter some or all of the trac trying to pass between the networks. Encrypting Router see Tunneling Router and Virtual Network Perimeter. Firewall A system or combination of systems that enforces a boundary between two or more networks. Host-based Security The technique of securing an individual system from attack. Host based security is operating system and version dependent. Insider Attack An attack originating from inside a protected network. Intrusion Detection Detection of break-ins or break-in attempts either manually or via software expert systems that operate on logs or other information available on the network. IP Spoong An attack whereby a system attempts to illicitly impersonate another system by using its IP network address. IP Splicing / Hijacking An attack whereby an active, established, session is intercepted and co-opted by the attacker. IP Splicing attacks may occur after an authentication has been made, permitting the attacker to assume the role of an already authorized user. Primary protections against IP Splicing rely on encryption at the session or network layer. Least Privilege Designing operational aspects of a system to operate with a minimum amount of system privilege. This reduces the authorization level at which various actions are performed and decreases the chance that a process or user with high privileges may be caused to perform unauthorized activity resulting in a security breach. Logging
42 de 44 30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
The process of storing information about events that occurred on the rewall or network. Log Retention How long audit logs are retained and maintained. Log Processing How audit logs are processed, searched for key events, or summarized. Network-Layer Firewall A rewall in which trac is examined at the network protocol packet layer. Perimeter-based Security The technique of securing a network by controlling access to all entry and exit points of the network. Policy Organization-level rules governing acceptable use of computing resources, security practices, and operational procedures. Proxy A software agent that acts on behalf of a user. Typical proxies accept a connection from a user, make a decision as to whether or not the user or client IP address is permitted to use the proxy, perhaps does additional authentication, and then completes a connection on behalf of the user to a remote destination. Screened Host A host on a network behind a screening router. The degree to which a screened host may be accessed depends on the screening rules in the router. Screened Subnet A subnet behind a screening router. The degree to which the subnet may be accessed depends on the screening rules in the router. Screening Router A router congured to permit or deny trac based on a set of permission rules installed by the administrator. Session Stealing See IP Splicing. Trojan Horse A software entity that appears to do something normal but which, in fact, contains a trapdoor or attack program. Tunneling Router A router or system capable of routing trac by encrypting it and encapsulating it for transmission across an untrusted network, for eventual de-encapsulation and decryption. Social Engineering An attack based on deceiving users or administrators at the target site. Social engineering attacks are typically carried out by telephoning users or operators
43 de 44 30/10/12 12:21
http://www.interhack.net/pubs/fwfaq/
and pretending to be an authorized user, to attempt to gain illicit access to systems. Virtual Network Perimeter A network that appears to be a single protected network behind rewalls, which actually encompasses encrypted virtual links over untrusted networks. Virus A replicating code segment that attaches itself to a program or data le. Viruses might or might not not contain attack programs or trapdoors. Unfortunately, many have taken to calling any malicious code a ``virus''. If you mean ``trojan horse'' or ``worm'', say ``trojan horse'' or ``worm''. Worm A standalone program that, when run, copies itself from one host to another, and then runs itself on each newly infected host. The widely reported ``Internet Virus'' of 1988 was not a virus at all, but actually a worm.
http://mail-abuse.org/
... Initiative2
http://mail-abuse.org/tsi/
... Squid3
http://squid.nlanr.net/
... Apache4
http://www.apache.org/docs/mod/mod_proxy.html
... Proxy5
http://home.netscape.com/proxy/v3.5/index.html
... Netscape6
http://developer.netscape.com/docs/manuals/security/sslin/contents.htm
... rewall7
http://www.real.com/firewall/
... bugtraq8
http://www.securityfocus.com
... online.9
http://www.thegild.com/firewall/.
44 de 44
30/10/12 12:21