From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50264 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751311AbeCEPRj (ORCPT ); Mon, 5 Mar 2018 10:17:39 -0500 Message-ID: <1520263056.5898.6.camel@redhat.com> Subject: Re: [PATCH net] netfilter: check for out-of-bounds while copying compat entries From: Paolo Abeni To: Florian Westphal Cc: netdev@vger.kernel.org, Pablo Neira Ayuso , Jozsef Kadlecsik , Stephen Hemminger , netfilter-devel@vger.kernel.org, syzkaller-bugs@googlegroups.com Date: Mon, 05 Mar 2018 16:17:36 +0100 In-Reply-To: <20180305143235.GK11889@breakpoint.cc> References: <334d4b64cf1adb8fe65ae4581d01b9698d5e23b1.1520258376.git.pabeni@redhat.com> <20180305143235.GK11889@breakpoint.cc> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: On Mon, 2018-03-05 at 15:32 +0100, Florian Westphal wrote: > 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 :-( Actually such commit fixes the issues (I just double-checked via syzbot), the issue is I did not pull such changeset before starting investigating this bug. This patch is not needed, thanks. Paolo