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 <netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH 1/1] netfilter: ctnetlink: don't permit ct creation with random tuple
Date: Tue, 12 Feb 2013 14:10:17 +0100	[thread overview]
Message-ID: <20130212131017.GA32460@localhost> (raw)
In-Reply-To: <20130212124328.GA30105@breakpoint.cc>

On Tue, Feb 12, 2013 at 01:43:28PM +0100, Florian Westphal wrote:
> Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > On Tue, Feb 12, 2013 at 10:22:38AM +0100, Florian Westphal wrote:
> > > Userspace can cause kernel panic by not specifying orig/reply
> > > tuple: kernel will create a tuple with random stack values.
> > > 
> > > Problem is that tuple.dst.dir will be random, too, which
> > > causes nf_ct_tuplehash_to_ctrack() to return garbage.
> 
> [..]
> 
> > > diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
> > > index 7bbfb3d..e592281 100644
> > > --- a/net/netfilter/nf_conntrack_netlink.c
> > > +++ b/net/netfilter/nf_conntrack_netlink.c
> > > @@ -1596,6 +1596,9 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
> > >  		if (nlh->nlmsg_flags & NLM_F_CREATE) {
> > >  			enum ip_conntrack_events events;
> > >  
> > > +			if (!cda[CTA_TUPLE_ORIG] ||
> > > +			    !cda[CTA_TUPLE_REPLY])
> > > +				return -EINVAL;
> > 
> > I think that needs to be && instead of ||.
> 
> Uh, maybe I'm too low on caffeine, but when a new conntrack
> is to be created, shouldn't userspace have to specify
> _both_ ORIG and REPLY?

You're right, it's me who is low on caffeine. Sorry.

  reply	other threads:[~2013-02-12 13:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12  9:22 [PATCH 1/1] netfilter: ctnetlink: don't permit ct creation with random tuple Florian Westphal
2013-02-12 12:24 ` Pablo Neira Ayuso
2013-02-12 12:43   ` Florian Westphal
2013-02-12 13:10     ` Pablo Neira Ayuso [this message]
2013-02-12 22:35 ` Pablo Neira Ayuso

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=20130212131017.GA32460@localhost \
    --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).