diff options
author | Florian Westphal <fw@strlen.de> | 2019-12-15 03:49:25 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-12-20 02:12:27 +0100 |
commit | e608f631f0ba5f1fc5ee2e260a3a35d13107cbfe (patch) | |
tree | 731589fa1005fce610483eff846f9379316e5727 /net/8021q | |
parent | d05d5db815d56a0ce203ed297153d9794dfdcb68 (diff) | |
download | linux-e608f631f0ba5f1fc5ee2e260a3a35d13107cbfe.tar.gz linux-e608f631f0ba5f1fc5ee2e260a3a35d13107cbfe.tar.bz2 linux-e608f631f0ba5f1fc5ee2e260a3a35d13107cbfe.zip |
netfilter: ebtables: compat: reject all padding in matches/watchers
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.
Reported-by: syzbot+f68108fed972453a0ad4@syzkaller.appspotmail.com
Fixes: 81e675c227ec ("netfilter: ebtables: add CONFIG_COMPAT support")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/8021q')
0 files changed, 0 insertions, 0 deletions