All of lore.kernel.org
 help / color / mirror / Atom feed
* iptables STILL incorrectly using TCP packet contents without checking header!
@ 2005-03-31 18:57 Simon Kirby
  2005-03-31 20:04 ` Jonas Berlin
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Kirby @ 2005-03-31 18:57 UTC (permalink / raw)
  To: netfilter-devel

Hi,

Since my post in December, iptables is STILL incorrectly using TCP packet
contents without checking the header.  I bet this is resulting in dropped
connections and other issues all over the place but people aren't easily
able to see why.

Example:

iptables -A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp -j REJECT --reject-with tcp-reset

These two lines will set up a typical stateful TCP firewall that blocks
anything incoming that isn't related to outgoing traffic.  Unfortunately,
it also immediately disconnects any TCP sessions as soon as a corrupted
packet is received.  Why?  Because:

The "state" module checks the TCP checksum.  Good.
The REJECT module uses TCP data without checking the checksum.  Bad.

In fact, a simple "-p tcp --dport 80" also matches without checking the
TCP checksum.  This is bad -- the port could be corrupted!

IMHO:

1: -p tcp needs to verify that the IP header is valid (it probably does
   this already), since the protocol is specified there.

2: -p tcp --dport 80 needs to verify that the IP _AND_ TCP header is
   valid, since the port is in the TCP header.  It does not do this now.

3: REJECT needs to verify that the data it is using in --tcp-reset is
   actually valid, because it can be used with just "-p tcp".  ICMP
   REJECT might also need checking.

Right?  Does this make sense?  Anyone?

(Yes, I'll fix the corrupted packets next..)

Simon-

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-04-05 14:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-31 18:57 iptables STILL incorrectly using TCP packet contents without checking header! Simon Kirby
2005-03-31 20:04 ` Jonas Berlin
2005-03-31 23:27   ` Henrik Nordstrom
2005-04-03 18:34     ` Patrick McHardy
2005-04-01  0:03   ` Simon Kirby
2005-04-05 14:24     ` Amin Azez

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.