lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191008060109.GA25052@breakpoint.cc>
Date:   Tue, 8 Oct 2019 08:01:09 +0200
From:   Florian Westphal <fw@...len.de>
To:     Maciej Żenczykowski <zenczykowski@...il.com>
Cc:     Maciej Żenczykowski <maze@...gle.com>,
        "David S . Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
        Cong Wang <xiyou.wangcong@...il.com>,
        Eric Dumazet <edumazet@...gle.com>,
        Pablo Neira Ayuso <pablo@...filter.org>
Subject: Re: [PATCH 1/2] netfilter: fix a memory leak in nf_conntrack_in

Maciej Żenczykowski <zenczykowski@...il.com> wrote:
> From: Maciej Żenczykowski <maze@...gle.com>
> 
> Cc: Cong Wang <xiyou.wangcong@...il.com>
> Cc: Eric Dumazet <edumazet@...gle.com>
> Cc: Pablo Neira Ayuso <pablo@...filter.org>
> Signed-off-by: Maciej Żenczykowski <maze@...gle.com>
> ---
>  net/netfilter/nf_conntrack_core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
> index 0c63120b2db2..35459d04a050 100644
> --- a/net/netfilter/nf_conntrack_core.c
> +++ b/net/netfilter/nf_conntrack_core.c
> @@ -1679,7 +1679,8 @@ nf_conntrack_in(struct sk_buff *skb, const struct nf_hook_state *state)
>  		if ((tmpl && !nf_ct_is_template(tmpl)) ||
>  		     ctinfo == IP_CT_UNTRACKED) {
>  			NF_CT_STAT_INC_ATOMIC(state->net, ignore);
> -			return NF_ACCEPT;
> +			ret = NF_ACCEPT;

This looks wrong.

> +			goto out;

This puts tmpl, causing underflow of skb->nfct.
When we enter nf_conntrack_in and this branch, then 'tmpl'
is already assigned to skb->nfct, it will be put when skb
is free'd.

nf_ct_get() doesn't increment the refcnt.

tmpl only needs to be put in case of ...


>  		}
>  		skb->_nfct = 0;

...this.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ