Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Aug 2001 18:21:45 -0300 (ART)
From:      Fernando Gleiser <fgleiser@cactus.fi.uba.ar>
To:        Dennis Jun <dennisjun@yahoo.com>
Cc:        <freebsd-questions@FreeBSD.ORG>
Subject:   Re: How do stateful firewalls help increase security?
Message-ID:  <20010816181009.L87051-100000@cactus.fi.uba.ar>
In-Reply-To: <20010816195750.15814.qmail@web11608.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 16 Aug 2001, Dennis Jun wrote:

> A friend of mine asked me this today and I coudln't
> give him a definite answer, even though I use stateful
> firewalls. I was wondering if any gurus could enlighten
> me. Thanx.

From the ipf-howto

<quote>

Implicit Allow; The "keep state" Rule

The job of your firewall is to prevent unwanted traffic getting to point B
from point A. We have general rules which say "as long as this packet is to
port 23, it's okay." We have general rules which say "as long as this packet
has its FIN flag set, it's okay." Our firewalls don't know the beginning,
middle, or end of any TCP/UDP/ICMP session. They merely have vague rules
that are applied to all packets. We're left to hope that the packet with its
FIN flag set isn't really a FIN scan, mapping our services. We hope that the
packet to port 23 isn't an attempted hijack of our telnet session. What if
there was a way to identify and authorize individual TCP/UDP/ICMP sessions
and distinguish them from port scanners and DoS attacks?
There is a way, it's called keeping state.

We want convenience and security in one. Lots of people do, that's why Ciscos
have an "established" clause that lets established tcp sessions go through.
Ipfw has established. Ipfwadm has setup/establised. They all have this feature,
but the name is very misleading. When we first saw it, we thought it meant
our packet filter was keeping track of what was going on, that it knew if a
connection was really established or not. The fact is, they're all taking the
packet's word for it from a part of the packet anybody can lie about. They
read the TCP packet's flags section and there's the reason UDP/ICMP don't
work with it, they have no such thing. Anybody who can create a packet with
bogus flags can get by a firewall with this setup.

Where does IPF come in to play here, you ask? Well, unlike the other firewalls,
IPF really can keep track of whether or not a connection is established. And
it'll do it with TCP, UDP and ICMP, not just TCP. Ipf calls it keeping state.
The keyword for the ruleset is keep state.

Up until now, we've told you that packets come in, then the ruleset gets
checked; packets go out, then the ruleset gets checked. Actually, what happens
is packets come in, the state table gets checked, then *maybe* the inbound
ruleset gets checked; packets go out, the state table gets checked, then
*maybe* the outbound ruleset gets checked. The state table is a list of
TCP/UDP/ICMP sessions that are unquestionadely passed through the firewall,
circumventing the entire ruleset.  Sound like a serious security hole? Hang on,
it's the best thing that ever happened to your firewall.

All TCP/IP sessions have a start, a middle, and an end (even though they're
sometimes all in the same packet). You can't have an end without a middle and
you can't have a middle without a start. This means that all you really need
to filter on is the beginning of a TCP/UDP/ICMP session. If the beginning of
the session is allowed by your firewall rules, you really want the middle
and end to be allowed too (lest your IP stack should ovrflow and your machines
become useless). Keeping state allows you to ignore the middle and end and
simply focus on blocking/passing new sessions. If the new session is passed,
all its subsequent packets will be allowed through. If it's blocked, none of
its subsequent packets will be allowed through.

</quote>

If you want a more technical description of the inner workings of the
state code of IPF, the is a paper by Guido van Rooij. I dont remember the
url, but I can find it if you are interested.


				Fer



>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010816181009.L87051-100000>