From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 960C8CE79D2 for ; Wed, 20 Sep 2023 12:06:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235179AbjITMGG (ORCPT ); Wed, 20 Sep 2023 08:06:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235243AbjITMGC (ORCPT ); Wed, 20 Sep 2023 08:06:02 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B087EA for ; Wed, 20 Sep 2023 05:05:56 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69DC1C433C9; Wed, 20 Sep 2023 12:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1695211555; bh=o4SFChxT9BioTXTBSEQG3otilR89PA+vTCiKcbFJ4XA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x6RowkZ2rGvWtYgnCU1mxRDBir38a4s+B+ha/Y+RsaEFCoPsIS2E/M/r/+ElMZdmu H7xCpqbwAnVIBJZim0YI7Ets2So4Gz3mRgz51+/aNmLF0T/fm6iZZ/SrHaXVK/ivnF +8KQAt9H+zznFcMnYXr/Rt2VzNzpEudB4VwO0aA4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Lucas Leong , Wander Lairson Costa , Pablo Neira Ayuso Subject: [PATCH 4.14 100/186] netfilter: xt_sctp: validate the flag_info count Date: Wed, 20 Sep 2023 13:30:03 +0200 Message-ID: <20230920112840.589342570@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230920112836.799946261@linuxfoundation.org> References: <20230920112836.799946261@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wander Lairson Costa commit e99476497687ef9e850748fe6d232264f30bc8f9 upstream. sctp_mt_check doesn't validate the flag_count field. An attacker can take advantage of that to trigger a OOB read and leak memory information. Add the field validation in the checkentry function. Fixes: 2e4e6a17af35 ("[NETFILTER] x_tables: Abstraction layer for {ip,ip6,arp}_tables") Cc: stable@vger.kernel.org Reported-by: Lucas Leong Signed-off-by: Wander Lairson Costa Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/xt_sctp.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/netfilter/xt_sctp.c +++ b/net/netfilter/xt_sctp.c @@ -149,6 +149,8 @@ static int sctp_mt_check(const struct xt { const struct xt_sctp_info *info = par->matchinfo; + if (info->flag_count > ARRAY_SIZE(info->flag_info)) + return -EINVAL; if (info->flags & ~XT_SCTP_VALID_FLAGS) return -EINVAL; if (info->invflags & ~XT_SCTP_VALID_FLAGS)