netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf] netfilter: nf_tables: avoid skb access on nf_stolen
Date: Tue, 28 Jun 2022 19:01:49 +0200	[thread overview]
Message-ID: <Yrsz88r5osn6nirQ@salvia> (raw)
In-Reply-To: <20220622144357.20162-1-fw@strlen.de>

On Wed, Jun 22, 2022 at 04:43:57PM +0200, Florian Westphal wrote:
> When verdict is NF_STOLEN, the skb might have been freed.
> 
> When tracing is enabled, this can result in a use-after-free:
> 1. access to skb->nf_trace
> 2. access to skb->mark
> 3. computation of trace id
> 4. dump of packet payload
> 
> To avoid 1, keep a cached copy of skb->nf_trace in the
> trace state struct.
> Refresh this copy whenever verdict is != STOLEN.
> 
> Avoid 2 by skipping skb->mark access if verdict is STOLEN.
> 
> 3 is avoided by precomputing the trace id.
> 
> Only dump the packet when verdict is not "STOLEN".

Applied, thanks

      reply	other threads:[~2022-06-28 17:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22 14:43 [PATCH nf] netfilter: nf_tables: avoid skb access on nf_stolen Florian Westphal
2022-06-28 17:01 ` Pablo Neira Ayuso [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yrsz88r5osn6nirQ@salvia \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).