All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emmanuel Fleury <fleury@cs.auc.dk>
To: netfilter-devel@lists.samba.org
Cc: Mikkel Christiansen <mixxel@cs.auc.dk>,
	Mikkel Refsgaard Bech <mrb@cs.auc.dk>,
	Torben Vinther Schmidt <mariachi@cs.auc.dk>,
	Carsten Stiborg <stiborg@cs.auc.dk>
Subject: Security flaw in Stateful filtering ??????
Date: Thu, 06 Jun 2002 19:21:04 +0200	[thread overview]
Message-ID: <3CFF9A00.2070805@cs.auc.dk> (raw)

Hi,

I am co-supervising students in Aalborg university on a project
about firewalls (and more precisely about stateful firewalling)
in collaboration with Mikkel Christiansen.

Recently, they were testing some of their ideas to improve the
connection tracking module of Netfilter in the university lab
and they discovered some weird things in the behaviour of
Netfilter.

I am just quoting their mail here:

=====
....

The Setup:
----------
A classical client-filter-server setup (two different networks on each
end with a filter/gateway in between). The filter/gateway is configured
to route between the two nets and has the following rules in IP Tables
as suggested by the documentation (see:
http://netfilter.samba.org/documentation/HOWTO/packet-filtering-HOWTO-5.html):

iptables -A FORWARD -p tcp -m state --state ESTABLISHED -j ACCEPT
iptables -A FORWARD -p tcp -m state --state NEW -j ACCEPT
iptables -A FORWARD -p tcp -j DROP

These rules should indicate that we allow packets that create new
connections and packets that are a part of an established connection.
We then drop everything else. These are not good rules for a filter but
they illustrate the point.


The Problem:
------------
When sending an ACK packet, the packet is allowed through the filter.
Due to the second rule. This means that ACK packets are accepted as
being in the state NEW and does not create an entry in the state table.
So if any rule state that we allow NEW connections, this rule can be
used for port scanning.

The ACK packet and the corresponding RST packet were observed on every
machine, i.e. client, server and filter. And, actually, we were able to 
perform a complete ACK scan of the whole network through the filter by
using "nmap -sA".


A Solution:
-----------
As a temporary hack the following rule can be added as the second rule:

iptables -A FORWARD -p tcp --tcp-flags ACK ACK -j DROP

However, this is not a solid solution and the code should be modified,
as we see it, not to recognize ACK packets as being in the state NEW.

We were wondering if this is intentional due to some reason that we
cannot see or if it is a flaw as suggested ?

We have found something about it in the Iptables tutorial (1.1.8),
page 54 (Appendix B, "State NEW packets but no SYN bit set").
But, this is not really convincing.

Any idea ????

Regards,
Mikkel Refsgaard Bech
Torben Vinther Schmidt
Carsten Stiborg
=====

For short:
- ACK packets are classified as NEW (without opening a connection),
- Therefore, allowing NEW packets allow all the ACK packets to go
   through,
- And consequently, in this setting, you can perform ACK scanning
   if you just trust the documentation...

Actually, I don't know what to answer to them. Has somebody any clue to
explain this ?

Regards
-- 
Emmanuel

Maybe somebody should tell gcc maintainers about programmers
that know more than the compiler again.
   -- Linus Torvalds

             reply	other threads:[~2002-06-06 17:21 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-06 17:21 Emmanuel Fleury [this message]
2002-06-06 17:48 ` Security flaw in Stateful filtering ?????? Martin Josefsson
2002-06-06 17:54 ` Maciej Soltysiak
2002-06-06 18:52   ` Emmanuel Fleury
2002-06-06 19:11     ` Maciej Soltysiak
2002-06-06 19:30     ` Guillaume Morin
2002-06-06 19:53       ` Patrick Schaaf
2002-06-06 19:43     ` Henrik Nordstrom
2002-06-06 17:57 ` Patrick Schaaf
2002-06-06 18:34   ` Emmanuel Fleury
2002-06-06 19:12     ` Patrick Schaaf
2002-06-06 19:28       ` Emmanuel Fleury
2002-06-06 19:27     ` Henrik Nordstrom
2002-06-06 20:50       ` Emmanuel Fleury
2002-06-06 21:26         ` Henrik Nordstrom
  -- strict thread matches above, loose matches on Subject: below --
2002-06-06 19:29 Sneppe Filip
2002-06-06 22:15 Andy Whitcroft
     [not found] <20020606220914.A14542@groar.org>
2002-06-06 23:31 ` Rusty Russell
2002-06-06 23:52   ` Joerg Mayer
2002-06-07  2:10     ` Rusty Russell
2002-06-07  2:53       ` Joerg Mayer
2002-06-07 12:45         ` Marcus Sundberg
2002-06-07 14:36       ` Henrik Nordstrom
2002-06-07 21:48     ` Ben Reser
2002-06-07  8:15   ` Emmanuel Fleury
2002-06-07  8:50     ` Oskar Andreasson
2002-06-07 12:27       ` Jozsef Kadlecsik
2002-06-10  8:04         ` Oskar Andreasson
2002-06-10  8:26           ` Emmanuel Fleury
2002-06-12  9:23           ` Jozsef Kadlecsik
2002-06-07  9:05     ` Henrik Nordstrom
2002-06-07  9:31       ` Emmanuel Fleury
2002-06-07  9:41         ` Oskar Andreasson
2002-06-07  9:43         ` Guillaume Morin
2002-06-07  9:57           ` Emmanuel Fleury
2002-06-07 10:17             ` Guillaume Morin
2002-06-07 11:30               ` Emmanuel Fleury
2002-06-07 13:33                 ` Guillaume Morin
2002-06-07 15:13                   ` Emmanuel Fleury
2002-06-07 18:36                     ` Guillaume Morin
2002-06-07 19:00                       ` Patrick Schaaf
2002-06-08  2:06                         ` Emmanuel Fleury
2002-06-08  8:21                           ` Patrick Schaaf
2002-06-08 12:02                             ` Henrik Nordstrom
2002-06-09  7:03                               ` Emmanuel Fleury
2002-06-09  8:29                                 ` Patrick Schaaf
2002-06-08  1:42                       ` Emmanuel Fleury
2002-06-07 10:17             ` Henrik Nordstrom
2002-06-07 10:11         ` Henrik Nordstrom
2002-06-07 22:02     ` Ben Reser
2002-06-08  2:13       ` Emmanuel Fleury
2002-06-08  8:23         ` Patrick Schaaf
2002-06-08 16:41         ` Ben Reser
2002-06-07  9:42 Mikkel Christiansen
2002-06-08  7:44 ` Harald Welte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CFF9A00.2070805@cs.auc.dk \
    --to=fleury@cs.auc.dk \
    --cc=mariachi@cs.auc.dk \
    --cc=mixxel@cs.auc.dk \
    --cc=mrb@cs.auc.dk \
    --cc=netfilter-devel@lists.samba.org \
    --cc=stiborg@cs.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.