Patchwork netfilter: nf_conntrack_ipv6: Plug sk_buff leak in fragment handling

login
register
mail settings
Submitter Phil Oester
Date June 19, 2013, 10:49 a.m.
Message ID <20130619104950.GA1343@gmail.com>
Download mbox | patch
Permalink /patch/252692/
State Accepted
Headers show

Comments

Phil Oester - June 19, 2013, 10:49 a.m.
In commit 4cdd3408 ("netfilter: nf_conntrack_ipv6: improve fragmentation
handling"), an sk_buff leak was introduced when dealing with reassembled
packets by grabbing a reference to the original skb instead of the
reassembled skb.  At this point, the leak only impacted conntracks with an
associated helper.  

In commit 58a317f1 ("netfilter: ipv6: add IPv6 NAT support"), the bug was
expanded to include all reassembled packets with unconfirmed conntracks.

Fix this by grabbing a reference to the proper reassembled skb.  This closes
netfilter bugzilla #823.

Phil

Signed-off-by: Phil Oester <kernel@linuxace.com>
Florian Westphal - June 20, 2013, 9:20 a.m.
Phil Oester <kernel@linuxace.com> wrote:
> In commit 4cdd3408 ("netfilter: nf_conntrack_ipv6: improve fragmentation
> handling"), an sk_buff leak was introduced when dealing with reassembled
> packets by grabbing a reference to the original skb instead of the
> reassembled skb.  At this point, the leak only impacted conntracks with an
> associated helper.  

David, could you please apply this patch directly in case Pablo doesn't
apply it first?  This fixes a remote DoS, so it better hit -stable ASAP.

Thanks.

[ archive link: http://patchwork.ozlabs.org/patch/252692/ ]

> diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
> index 97bcf2b..c9b6a6e 100644
> --- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
> +++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
> @@ -204,7 +204,7 @@ static unsigned int __ipv6_conntrack_in(struct net *net,
>  		if (ct != NULL && !nf_ct_is_untracked(ct)) {
>  			help = nfct_help(ct);
>  			if ((help && help->helper) || !nf_ct_is_confirmed(ct)) {
> -				nf_conntrack_get_reasm(skb);
> +				nf_conntrack_get_reasm(reasm);
>  				NF_HOOK_THRESH(NFPROTO_IPV6, hooknum, reasm,
>  					       (struct net_device *)in,
>  					       (struct net_device *)out,

Thanks for fixing it, but personally I would have preferred a short early
warning period.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pablo Neira - June 20, 2013, 9:56 a.m.
On Thu, Jun 20, 2013 at 11:20:31AM +0200, Florian Westphal wrote:
> Phil Oester <kernel@linuxace.com> wrote:
> > In commit 4cdd3408 ("netfilter: nf_conntrack_ipv6: improve fragmentation
> > handling"), an sk_buff leak was introduced when dealing with reassembled
> > packets by grabbing a reference to the original skb instead of the
> > reassembled skb.  At this point, the leak only impacted conntracks with an
> > associated helper.  
> 
> David, could you please apply this patch directly in case Pablo doesn't
> apply it first?  This fixes a remote DoS, so it better hit -stable ASAP.

I'll take care of it.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index 97bcf2b..c9b6a6e 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -204,7 +204,7 @@  static unsigned int __ipv6_conntrack_in(struct net *net,
 		if (ct != NULL && !nf_ct_is_untracked(ct)) {
 			help = nfct_help(ct);
 			if ((help && help->helper) || !nf_ct_is_confirmed(ct)) {
-				nf_conntrack_get_reasm(skb);
+				nf_conntrack_get_reasm(reasm);
 				NF_HOOK_THRESH(NFPROTO_IPV6, hooknum, reasm,
 					       (struct net_device *)in,
 					       (struct net_device *)out,