[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210331205310.GA3141668@madcap2.tricolour.ca>
Date: Wed, 31 Mar 2021 16:53:10 -0400
From: Richard Guy Briggs <rgb@...hat.com>
To: Pablo Neira Ayuso <pablo@...filter.org>
Cc: Linux-Audit Mailing List <linux-audit@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
netfilter-devel@...r.kernel.org, Paul Moore <paul@...l-moore.com>,
Eric Paris <eparis@...isplace.org>,
Steve Grubb <sgrubb@...hat.com>,
Florian Westphal <fw@...len.de>, Phil Sutter <phil@....cc>,
twoerner@...hat.com, tgraf@...radead.org, dan.carpenter@...cle.com,
Jones Desougi <jones.desougi+netfilter@...il.com>
Subject: Re: [PATCH v5] audit: log nftables configuration change events once
per table
On 2021-03-31 22:22, Pablo Neira Ayuso wrote:
> On Fri, Mar 26, 2021 at 01:38:59PM -0400, Richard Guy Briggs wrote:
> > Reduce logging of nftables events to a level similar to iptables.
> > Restore the table field to list the table, adding the generation.
> >
> > Indicate the op as the most significant operation in the event.
>
> There's a UAF, Florian reported. I'm attaching an incremental fix.
>
> nf_tables_commit_audit_collect() refers to the trans object which
> might have been already released.
Got it. Thanks Pablo. I didn't see it when running nft-test.py Where
was it reported? Here I tried to stay out of the way by putting that
call at the end of the loop but that was obviously a mistake in
hindsight. :-)
> commit e4d272948d25b66d86fc241cefd95281bfb1079e
> Author: Pablo Neira Ayuso <pablo@...filter.org>
> Date: Wed Mar 31 22:19:51 2021 +0200
>
> netfilter: nf_tables: use-after-free
>
> Signed-off-by: Pablo Neira Ayuso <pablo@...filter.org>
>
> diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
> index 5dd4bb7cabf5..01674c0d9103 100644
> --- a/net/netfilter/nf_tables_api.c
> +++ b/net/netfilter/nf_tables_api.c
> @@ -8063,6 +8063,8 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
> net->nft.gencursor = nft_gencursor_next(net);
>
> list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) {
> + nf_tables_commit_audit_collect(&adl, trans->ctx.table,
> + trans->msg_type);
> switch (trans->msg_type) {
> case NFT_MSG_NEWTABLE:
> if (nft_trans_table_update(trans)) {
> @@ -8211,8 +8213,6 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
> }
> break;
> }
> - nf_tables_commit_audit_collect(&adl, trans->ctx.table,
> - trans->msg_type);
> }
>
> nft_commit_notify(net, NETLINK_CB(skb).portid);
- RGB
--
Richard Guy Briggs <rgb@...hat.com>
Sr. S/W Engineer, Kernel Security, Base Operating Systems
Remote, Ottawa, Red Hat Canada
IRC: rgb, SunRaycer
Voice: +1.647.777.2635, Internal: (81) 32635
Powered by blists - more mailing lists