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: <20230831145048.GC15759@breakpoint.cc>
Date: Thu, 31 Aug 2023 16:50:48 +0200
From: Florian Westphal <fw@...len.de>
To: Wander Lairson Costa <wander@...hat.com>
Cc: Florian Westphal <fw@...len.de>,
	Pablo Neira Ayuso <pablo@...filter.org>,
	Jozsef Kadlecsik <kadlec@...filter.org>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Fernando Fernandez Mancera <ffmancera@...eup.net>,
	"open list:NETFILTER" <netfilter-devel@...r.kernel.org>,
	"open list:NETFILTER" <coreteam@...filter.org>,
	"open list:NETWORKING [GENERAL]" <netdev@...r.kernel.org>,
	open list <linux-kernel@...r.kernel.org>, stable@...nel.org
Subject: Re: [PATCH nf v2] netfilter/osf: avoid OOB read

Wander Lairson Costa <wander@...hat.com> wrote:
> On Thu, Aug 31, 2023 at 10:37 AM Florian Westphal <fw@...len.de> wrote:
> >
> > Wander Lairson Costa <wander@...hat.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
> > whatsoever.
> >
> 
> I didn't get it. It guarantees there is no OOB read of the opt array.

Sorry.  This is enough to validate opt_num.

But other members need validation too.

> > 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.
> >
> 
> I think the correct way would be memchr(genre/version/subtype, 0, MAXGENRELEN).

I don't really care how it looks like, just that its clear that
it is supposed to catch and reject non-null terminated c strings

:-)

> > Maybe there is more to be validated. I did not followup with all the
> >
> 
> I focused on the reported issue mainly because I am unfamiliar with
> the Netfilter layer. Let me take a deeper look.

I don't think there is anyone really familiar with OSF infra, it
was added quite a while back.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ