AFDB logo
mn :: comp :: net

LRP Firewall FAQ
Jack Coates, jack@monkeynoodle.org


Revision History:
12-5-00, lengthened and modified an email, nothing LRP specific yet.
1-16-01, discussion of proxy servers on firewalls.
9-10-01, typos, URLs.

The proper policy is default deny, then open up required ports if needed. While this sounds overly simplistic, it's the best policy possible. The weakness comes about in the ports that are required. If you really want to know more, Building Internet Firewalls by Chapman & Zwicky is a good start. In the meantime, here's a quick overview.

When a client wants to talk to a server, generally it will choose a random port between 1025 and 65535 as the source port. Destination is the server's well known service port, such as 80, 25, 443, &c. There are exceptions and this isn't a published standard, but most of the time that's the way it works in real life.

If you want to make your network more secure, you might use Access Control Lists (ACL's) to build a policy that denies traffic. Depending on the platform you're working with, this might mean ipfwadm statements, ipchains statements, or Cisco IOS commands. Unfortunately, if you want to make a server available you can't predict where the clients will be or what source port they'll use, so you have to write a rule that allows any client to come from any port 1025:65535 into your port 80.

If you don't like the idea of doing that, you might implement a stateful inspection engine, such as Check Point's FireWall-1 or Cisco's CBAC. Those work by maintaining a table of known sessions:
outsidefirewallinside
SYN request, 1025 -> 80
does policy allow connection to port 80? If yes, then open 1025 <-> 80, forward this packet.
SYN-ACK, 1025 <- 80
session is real, so enter it into the state table. Future traffic on TCP 1025 <- 80 can be accepted without inspection until timeout.

Only traffic that is from the originally initiated session will be allowed in. Theoretically this means that the session will be harder (though not impossible) to hijack, though in real life it means very little. Hijacking a session is too hard and has too little payoff compared to the real threats: distributed denials of service (DDoS), breaking into servers, and snarfing useful information out of the traffic stream. More on these later. The stateful inspection engine vendors will also tell you that stateful inspection allows the firewall to "make sure that [telnet] is really [telnet]" or even "make sure that the commands in the traffic stream are proper [telnet] commands." The first statement is marketingspeak for "deny client ports that are known service ports." In other words, here's a possible attack:
outsidefirewallinside
SYN request, 21 -> 23
policy allows connection to port 23,so open 21 <-> 23, forward this packet.
SYN-ACK, 21 <- 23
session is real, so enter it into the state table. Future traffic on TCP 21 <- 23 can be accepted without inspection until timeout.
Kill telnetd with a buffer overflow and initiate FTP connection from inside server.

So Check Point will deny SYNs from source ports that are well known service ports. Of course, since well-known service ports are merely a convention and TCP connections can be made from any port to any port, I fail to see how this behavior, in and of itself, provides very much protection against a tool like ftp_ozone.

Now if the firewall was actually able to analyze the payload of packets for valid commands in the service which is supposedly being allowed, that would be pretty keen and would make the second Check Point marketing statement accurate. However, it's not true and won't be true any time soon because doing so would soak performance, even if it were possible to implement. If you want to analyze the application level payload you have to use a proxy, not a stateful inspection engine.

One cool thing that is very simple which Check Point does is deny incoming packets which aren't SYN packets, unless they match an entry in the state table. These generate a log message, "received packet from unknown established TCP session." (This functionality is broken by service pack 2 to the 4.1 release, unfortunately.) Categorically denying this sort of traffic is a good idea, so let's all look forward to trying out the stateful inspection engine in kernel 2.4. Another nice thing Check Point trains its admins to do is implement a "stealth rule." This rule silently drops any packet which is destined for one of the firewall's interfaces. This can and should be done with LRP as well.

If you really want tight control, you use a proxy server. This is a server that provides the same service(s) that you wanted to make public, but it relays the traffic between the client and the real server. By making the proxy server tight and featureless, the security admin can reduce the foothold presented to a hacker. In a DoS attack, the solution fails safe by crashing the proxy, not real systems. However, proxies are relatively slow, difficult to configure, and usually don't support the latest and greatest bells and whistles. Both CPFW and Cisco provide some limited proxy service for common things like SMTP and HTTP. It is architecturally flawed to do so, and the only reason they do it is to provide a lower price. The "single box for a single purpose" model has been evolved through experience, not vendor whim. I cannot stress enough that you should be very careful when choosing proxy software. If the proxy itself is vulnerable to buffer overflow, you've just given the bad guys a root shell on your firewall with access to the networks that the firewall is supposed to protect. If you're going to use a proxy, INSIST on a well audited open source platform. If the network you're protecting is valuable, I recommend using an OpenBSD server with Postfix for the SMTP and another OpenBSD server with Squid for the HTTP. Using commercial software because it is enough to show due diligence may make your lawyers happy, but it won't keep out the bad guys. Commercial security software may or may not be safe and if you get the right people to talk to you off-the-record, the companies involved will admit it. Quality of the software and market capitalization have no correlation.

If you're not yet fully convinced that putting a proxy onto your firewall box or border router is a bad idea, think about this. Even if the proxy software you want to use is certifiably 100% bug free and otherwise invulnerable to the common buffer overflow (snicker), it is still a single process operating on a server/router/whatever which has other things to do (e.g. analyzing and passing or denying traffic). This means that events which cause high CPU utilization or RAM utilization will take away from the effectiveness of your firewall. It also means that your firewall needs to receive traffic on the ports which the proxy application listens to, so bye-bye stealth mode.

Now, here's how these solutions stack up against the real world attacks:

To summarize, you wouldn't see much benefit from switching away from Linux Router Project onto a commercial firewall package for security policy implementation. While it is theoretically tighter to use a stateful inspection engine, the true value to a package like Check Point is in the management GUI, support channel, and added services such as VPN and virus scanning.

Jack Coates
jack@monkeynoodle.org

Last modified: Oct 24, 2008 2:28 pm.
Contact me.

Powered by Zope