]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nf_ct_tcp: fix accepting invalid RST segments
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Mon, 25 May 2009 15:23:15 +0000 (17:23 +0200)
committerPatrick McHardy <kaber@trash.net>
Mon, 25 May 2009 15:23:15 +0000 (17:23 +0200)
commit6799964cc259ce0885b668b9d4d44b28b57ded8f
treedd06bf91db9aff84adf442b6c8aa6be58c923ec0
parente9f28176c74d27f05e2dfc6e21da79626ee30a0b
netfilter: nf_ct_tcp: fix accepting invalid RST segments

Robert L Mathews discovered that some clients send evil TCP RST segments,
which are accepted by netfilter conntrack but discarded by the
destination. Thus the conntrack entry is destroyed but the destination
retransmits data until timeout.

The same technique, i.e. sending properly crafted RST segments, can easily
be used to bypass connlimit/connbytes based restrictions (the sample
script written by Robert can be found in the netfilter mailing list
archives).

The patch below adds a new flag and new field to struct ip_ct_tcp_state so
that checking RST segments can be made more strict and thus TCP conntrack
can catch the invalid ones: the RST segment is accepted only if its
sequence number higher than or equal to the highest ack we seen from the
other direction. (The last_ack field cannot be reused because it is used
to catch resent packets.)

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Patrick McHardy <kaber@trash.net>
include/linux/netfilter/nf_conntrack_tcp.h
net/netfilter/nf_conntrack_proto_tcp.c