From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org,
rgb@redhat.com, fwestpha@redhat.com, pmoore@redhat.com,
pvrabec@redhat.com, davem@davemloft.net,
Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH nf] xtables: zero padding in data_to_user
Date: Mon, 15 May 2017 18:52:22 +0200 [thread overview]
Message-ID: <20170515165222.GA3986@salvia> (raw)
In-Reply-To: <20170509201737.102987-1-willemdebruijn.kernel@gmail.com>
On Tue, May 09, 2017 at 04:17:37PM -0400, Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@google.com>
>
> When looking up an iptables rule, the iptables binary compares the
> aligned match and target data (XT_ALIGN). In some cases this can
> exceed the actual data size to include padding bytes.
>
> Before commit f77bc5b23fb1 ("iptables: use match, target and data
> copy_to_user helpers") the malloc()ed bytes were overwritten by the
> kernel with kzalloced contents, zeroing the padding and making the
> comparison succeed. After this patch, the kernel copies and clears
> only data, leaving the padding bytes undefined.
>
> Extend the clear operation from data size to aligned data size to
> include the padding bytes, if any.
>
> Padding bytes can be observed in both match and target, and the bug
> triggered, by issuing a rule with match icmp and target ACCEPT:
>
> iptables -t mangle -A INPUT -i lo -p icmp --icmp-type 1 -j ACCEPT
> iptables -t mangle -D INPUT -i lo -p icmp --icmp-type 1 -j ACCEPT
Applied, thanks.
prev parent reply other threads:[~2017-05-15 16:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-09 20:17 [PATCH nf] xtables: zero padding in data_to_user Willem de Bruijn
2017-05-15 16:52 ` 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=20170515165222.GA3986@salvia \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=fwestpha@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pmoore@redhat.com \
--cc=pvrabec@redhat.com \
--cc=rgb@redhat.com \
--cc=willemb@google.com \
--cc=willemdebruijn.kernel@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.