From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from Chamillionaire.breakpoint.cc ([146.0.238.67]:33554 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752907AbeCEOcm (ORCPT ); Mon, 5 Mar 2018 09:32:42 -0500 Date: Mon, 5 Mar 2018 15:32:35 +0100 From: Florian Westphal To: Paolo Abeni Cc: netdev@vger.kernel.org, Pablo Neira Ayuso , Florian Westphal , Jozsef Kadlecsik , Stephen Hemminger , netfilter-devel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [PATCH net] netfilter: check for out-of-bounds while copying compat entries Message-ID: <20180305143235.GK11889@breakpoint.cc> References: <334d4b64cf1adb8fe65ae4581d01b9698d5e23b1.1520258376.git.pabeni@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <334d4b64cf1adb8fe65ae4581d01b9698d5e23b1.1520258376.git.pabeni@redhat.com> Sender: netdev-owner@vger.kernel.org List-ID: Paolo Abeni wrote: > Currently, when coping ebt compat entries, no checks are in place > for the offsets provided by user space, so that syzbot was able to > trigger the following splat: > --- > net/bridge/netfilter/ebtables.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c > index 02c4b409d317..54ceaff701fb 100644 > --- a/net/bridge/netfilter/ebtables.c > +++ b/net/bridge/netfilter/ebtables.c > @@ -2114,7 +2114,7 @@ static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base, > unsigned int size; > char *buf = buf_start + offsets[i]; > > - if (offsets[i] > offsets[j]) > + if (offsets[i] > offsets[j] || offsets[j] > *total) > return -EINVAL; I thought i fixed this via b71812168571fa55e44cdd0254471331b9c4c4c6, and, after looking at it again I still don't see why that doesn't cover this :-(