: invaild TCP/UDP matching when ipv6 extension header exists
Subsystems (4)
PATCH 1/1 : invaild TCP/UDP matching when ipv6 extension header exists
Hi,
tcp_match() and udp_match() in ip6tables.c assume that previous header of TCP/UDP header is IPv6 Header. So, for example, 1st of fragmented UDP packet, AHed packets can't correctly match the rules which use "--sport" and so on.
This patch use ipv6_skip_exthdr() . But this function has the bug which access invalid memory area when found Fragment Header.
So this patch includes the change for that, too.
Regards,
----------------------------------------
Yasuyuki KOZAKAI
Communication Platform Laboratory,
Corporate Research & Development Center,
Toshiba Corporation
[email protected]
----------------------------------------
Subject: (usagi-users 02784) about fragment (ip6tables)
From: [email protected]
Date: Tue, 27 Jan 2004 01:12:45 +0000
Quoted 32 lines
Hello Users Group,
Quoted 1 line
From contents which are asked here, although it may not be, I need your
help well.
There is a question about the filtering method of fragment pachet using ip6tables.
A and B prepare two PCs, the command of ip6tables of the following [ B ] is
struck,
and 4000 bytes of UDP packet (address port number 1025) is sent from A to B.(
PC_B) %ip6tables -A INPUT -p udp -m frag --dport 1025 -j DROPIn this environment, since MTU was 1500 bytes, the packet was fragmentation-ized by three, and all the packets reached and carried out to B.
Then, although it is a question, since there is information on a port number in the
first fragmentation-ized packet, although it thinks that it is filtered andtwo of succession pass, why is it?
Is it the specification which cannot use the frag option and the port option together?
If there is a person who knows, I will advice-wish-do.
_________________________________________________________________
Sorry, I forgot to send the patch.
From: Yasuyuki Kozakai <[email protected]>
Date: Sat, 31 Jan 2004 15:49:32 +0900 (JST)
Quoted 8 lines
Hi,
tcp_match()andudp_match()inip6tables.cassume that previous header of TCP/UDP header is IPv6 Header. So, for example, 1st of fragmented UDP packet, AHed packets can't correctly match the rules which use "--sport" and so on.
Quoted 5 lines
This patch use
ipv6_skip_exthdr(). But this function has the bug which access invalid memory area when found Fragment Header.
So this patch includes the change for that, too.Regards,
net/ipv6/exthdrs.c +10 -2
@@ -738,8 +738,16 @@if (skb_copy_bits (skb, start, &hdr,sizeof (hdr)))BUG ();if (nexthdr ==NEXTHDR_FRAGMENT ) { -struct frag_hdr *fhdr = (struct frag_hdr *) &hdr; -if (ntohs (fhdr->frag_off) & ~0x7 ) +unsigned short frag_off; +if (skb_copy_bits (skb, + start+offsetof(struct frag_hdr , + frag_off), + &frag_off, +sizeof (frag_off))) { +return -1 ; + } + +if (ntohs (frag_off) & ~0x7 )break ; hdrlen =8 ; }else if (nexthdr ==NEXTHDR_AUTH )
net/ipv6/ipv6_syms.c +1 -0
@@ -46,3 +46,4 @@EXPORT_SYMBOL (ip6_flush_pending_frames);EXPORT_SYMBOL (ip6_push_pending_frames);EXPORT_SYMBOL (ipv6_push_nfrag_opts); +EXPORT_SYMBOL (ipv6_skip_exthdr);
net/ipv6/netfilter/ip6_tables.c +68 -45
161 lines not on this page · raw message
Hello,
I sent the patch which fixes this bug to netfilter-devel, but it include other bug... sorry, I rewrite patch for ip6_tables.c .
Please don't forget apply the patch which fixes the bug in ipv6_skip_exthdr() before you tests this patch. I sent it last few minutes to netdev and netfilter-devel.
Regards,
-----------------------------------------------------------------
Yasuyuki KOZAKAI @ USAGI Project <[email protected]>
From: Yasuyuki Kozakai <[email protected]>
Subject: [PATCH]: invaild TCP/UDP matching when ipv6 extension header exists
Date: Sat, 31 Jan 2004 15:49:32 +0900 (JST)
Quoted 7 lines
Hi,
tcp_match()andudp_match()inip6tables.cassume that previous header of TCP/UDP header is IPv6 Header. So, for example, 1st of fragmented UDP packet, AHed packets can't correctly match the rules which use "--sport" and so on.
Quoted 5 lines
This patch use
ipv6_skip_exthdr(). But this function has the bug which access invalid memory area when found Fragment Header.
So this patch includes the change for that, too.Regards,
net/ipv6/ipv6_syms.c +1 -0
@@ -46,3 +46,4 @@EXPORT_SYMBOL (ip6_flush_pending_frames);EXPORT_SYMBOL (ip6_push_pending_frames);EXPORT_SYMBOL (ipv6_push_nfrag_opts); +EXPORT_SYMBOL (ipv6_skip_exthdr);
net/ipv6/netfilter/ip6_tables.c +41 -2
69 lines not on this page · raw message
David S. Miller
AppliedQuoted 6 lines · On Fri, 20 Feb 2004 15:12:17 +0900 (JST) Yasuyuki Kozakai…
I sent the patch which fixes this bug to netfilter-devel, but it include other bug... sorry, I rewrite patch for
ip6_tables.c.Please don't forget apply the patch which fixes the bug in
ipv6_skip_exthdr()before you tests this patch. I sent it last few minutes to netdev and netfilter-devel.
I have applied this patch too, thanks a lot.
Hi,
This patch is for linux 2.4.26-pre1 .
Summery:tcp_match() and udp_match() in ip6tables.c assume that previous header of TCP/UDP header is IPv6 Header. So, for example, 1st of fragmented UDP packet, AHed packets can't correctly match the rules which use "--sport" and so on.
-----------------------------------------------------------------
Yasuyuki KOZAKAI @ USAGI Project <[email protected]>
From: "David S. Miller" <[email protected]>
Date: Fri, 20 Feb 2004 09:31:58 -0800
Quoted 11 lines
Quoted 6 lines · On Fri, 20 Feb 2004 15:12:17 +0900 (JST) Yasuyuki Kozakai…
I sent the patch which fixes this bug to netfilter-devel, but it include other bug... sorry, I rewrite patch for
ip6_tables.c.Please don't forget apply the patch which fixes the bug in
ipv6_skip_exthdr()before you tests this patch. I sent it last few minutes to netdev and netfilter-devel.I have applied this patch too, thanks a lot.
net/ipv6/ipv6_syms.c +2 -0
@@ -33,3 +33,5 @@EXPORT_SYMBOL (ipv6_get_saddr);EXPORT_SYMBOL (ipv6_chk_addr);EXPORT_SYMBOL (in6_dev_finish_destroy); +EXPORT_SYMBOL (ipv6_skip_exthdr); +
net/ipv6/netfilter/ip6_tables.c +41 -2
69 lines not on this page · raw message
Quoted 7 lines · On Thu, 26 Feb 2004 13:05:50 +0900 (JST) Yasuyuki Kozakai…
This patch is for linux 2.4.26-pre1 .
Summery:
tcp_match()andudp_match()inip6tables.cassume that previous header of TCP/UDP header is IPv6 Header. So, for example, 1st of fragmented UDP packet, AHed packets can't correctly match the rules which use "--sport" and so on.
Also applied, thank you.