netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Wander Lairson Costa <wander@redhat.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	Jozsef Kadlecsik <kadlec@netfilter.org>,
	Florian Westphal <fw@strlen.de>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Fernando Fernandez Mancera <ffmancera@riseup.net>,
	"open list:NETFILTER" <netfilter-devel@vger.kernel.org>,
	"open list:NETFILTER" <coreteam@netfilter.org>,
	"open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	Lucas Leong <wmliang@infosec.exchange>,
	stable@kernel.org
Subject: Re: [PATCH nf v2] netfilter/osf: avoid OOB read
Date: Thu, 31 Aug 2023 15:37:50 +0200	[thread overview]
Message-ID: <20230831133750.GB15759@breakpoint.cc> (raw)
In-Reply-To: <20230831123931.60606-1-wander@redhat.com>

Wander Lairson Costa <wander@redhat.com> wrote:
> 
> diff --git a/net/netfilter/nfnetlink_osf.c b/net/netfilter/nfnetlink_osf.c
> index 8f1bfa6ccc2d..13fedf2aaa0f 100644
> --- a/net/netfilter/nfnetlink_osf.c
> +++ b/net/netfilter/nfnetlink_osf.c
> @@ -315,6 +315,9 @@ static int nfnl_osf_add_callback(struct sk_buff *skb,
>  
>  	f = nla_data(osf_attrs[OSF_ATTR_FINGER]);
>  
> +	if (f->opt_num > ARRAY_SIZE(f->opt))
> +		return -EINVAL;
> +

Hmm, this isn't enough; as far as I can see there is no validation
whatsover.

This should also check that all of:

 char    genre[MAXGENRELEN];
 char    version[MAXGENRELEN];
 char    subtype[MAXGENRELEN];

... have a NUL byte.  You could use strnlen() == ARRAY_SIZE() -> EINVAL
for those.

Maybe there is more to be validated, I did not followup with all the
nested structures buried in user_finger struct.

  reply	other threads:[~2023-08-31 13:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31 12:39 [PATCH nf v2] netfilter/osf: avoid OOB read Wander Lairson Costa
2023-08-31 13:37 ` Florian Westphal [this message]
2023-08-31 14:45   ` Wander Lairson Costa
2023-08-31 14:50     ` Florian Westphal
2023-08-31 15:31 ` Fernando F. Mancera

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=20230831133750.GB15759@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=ffmancera@riseup.net \
    --cc=kadlec@netfilter.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=stable@kernel.org \
    --cc=wander@redhat.com \
    --cc=wmliang@infosec.exchange \
    /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).