From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org,
syzbot+f68108fed972453a0ad4@syzkaller.appspotmail.com,
syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH nf] netfilter: ebtables: compat: reject all padding in matches/watchers
Date: Fri, 20 Dec 2019 02:11:24 +0100 [thread overview]
Message-ID: <20191220011124.addyezhijttukqw5@salvia> (raw)
In-Reply-To: <20191215024925.10872-1-fw@strlen.de>
On Sun, Dec 15, 2019 at 03:49:25AM +0100, Florian Westphal wrote:
> syzbot reported following splat:
>
> BUG: KASAN: vmalloc-out-of-bounds in size_entry_mwt net/bridge/netfilter/ebtables.c:2063 [inline]
> BUG: KASAN: vmalloc-out-of-bounds in compat_copy_entries+0x128b/0x1380 net/bridge/netfilter/ebtables.c:2155
> Read of size 4 at addr ffffc900004461f4 by task syz-executor267/7937
>
> CPU: 1 PID: 7937 Comm: syz-executor267 Not tainted 5.5.0-rc1-syzkaller #0
> size_entry_mwt net/bridge/netfilter/ebtables.c:2063 [inline]
> compat_copy_entries+0x128b/0x1380 net/bridge/netfilter/ebtables.c:2155
> compat_do_replace+0x344/0x720 net/bridge/netfilter/ebtables.c:2249
> compat_do_ebt_set_ctl+0x22f/0x27e net/bridge/netfilter/ebtables.c:2333
> [..]
>
> Because padding isn't considered during computation of ->buf_user_offset,
> "total" is decremented by fewer bytes than it should.
>
> Therefore, the first part of
>
> if (*total < sizeof(*entry) || entry->next_offset < sizeof(*entry))
>
> will pass, -- it should not have. This causes oob access:
> entry->next_offset is past the vmalloced size.
>
> Reject padding and check that computed user offset (sum of ebt_entry
> structure plus all individual matches/watchers/targets) is same
> value that userspace gave us as the offset of the next entry.
Applied, thanks.
next prev parent reply other threads:[~2019-12-20 1:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-14 21:04 KASAN: vmalloc-out-of-bounds Read in compat_copy_entries syzbot
2019-12-15 2:49 ` [PATCH nf] netfilter: ebtables: compat: reject all padding in matches/watchers Florian Westphal
2019-12-20 1:11 ` Pablo Neira Ayuso [this message]
2019-12-15 6:31 ` KASAN: vmalloc-out-of-bounds Read in compat_copy_entries syzbot
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=20191220011124.addyezhijttukqw5@salvia \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=syzbot+f68108fed972453a0ad4@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox