All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Laura Garcia Liebana <nevola@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH v4] netfilter: nf_tables: Ensure init attributes are within the bounds
Date: Thu, 25 Aug 2016 13:29:36 +0200	[thread overview]
Message-ID: <20160825112936.GA11823@salvia> (raw)
In-Reply-To: <20160818160623.GA25544@sonyv>

Hi Laura,

On Thu, Aug 18, 2016 at 06:06:26PM +0200, Laura Garcia Liebana wrote:
> Check for overflow of u8 fields from u32 netlink attributes and maximum
> values.

After a closer look, this lack of validation seems more widespread
than I initially expected.

Look, other enums like:

enum nft_set_policies {
        NFT_SET_POL_PERFORMANCE,
        NFT_SET_POL_MEMORY,
};

that has no _MAX definition are suspect, actually looking at
net/netfilter/nf_tables_api.c more specifically at
nft_select_set_ops() you'll notice that the switch there doesn't seem
to reject anything over NFT_SET_POL_MEMORY.

So I would review net/netfilter/nf_tables_api.c too.

BTW, I think it is a good idea to add something like:

	err = nft_parse_u8(ntohl(nla_get_be32(tb[NFTA_BITWISE_LEN]),
                           &priv->len);
        if (err < 0)
                return err;

that we can consistently use all over the code, instead of open
coding:

        len = ...
        if (len > U8_MAX)
                return -ERANGE;

> Refer to 4da449ae1df

Please, use this format instead to refer to patches:

4da449a ("netfilter: nft_exthdr: Add size check on u8 nft_exthdr attributes")

Thanks!

      reply	other threads:[~2016-08-25 11:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-18 16:06 [PATCH v4] netfilter: nf_tables: Ensure init attributes are within the bounds Laura Garcia Liebana
2016-08-25 11:29 ` 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=20160825112936.GA11823@salvia \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=nevola@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.