From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD1511170E for ; Mon, 11 Sep 2023 14:21:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BD54C433C7; Mon, 11 Sep 2023 14:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1694442070; bh=jq12ShWOcDc+ii541OxRm34pzNN4UFE3i/Ri83h4iB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VllbP8dgiJJqtyWZtiZlvmfnbfWqUi48f6pF3xz1FHnwPg1dkZnuLVRth5x6TriFB Vle75/YHo1xKfytZr6uTv33AQMfPHyXtnMHH2JoC9vboY6iYMchg7eadQt4EeCvkfX QbWks4vpUihq1pzzV//YAmboXcm738pzo/K2A4b0= 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 6.5 635/739] netfilter: xt_sctp: validate the flag_info count Date: Mon, 11 Sep 2023 15:47:14 +0200 Message-ID: <20230911134708.832999017@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230911134650.921299741@linuxfoundation.org> References: <20230911134650.921299741@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.5-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)