[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230828221255.124812-1-wander@redhat.com>
Date: Mon, 28 Aug 2023 19:12:55 -0300
From: Wander Lairson Costa <wander@...hat.com>
To: Pablo Neira Ayuso <pablo@...filter.org>,
Jozsef Kadlecsik <kadlec@...filter.org>,
Florian Westphal <fw@...len.de>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Harald Welte <laforge@...filter.org>,
netfilter-devel@...r.kernel.org (open list:NETFILTER),
coreteam@...filter.org (open list:NETFILTER),
netdev@...r.kernel.org (open list:NETWORKING [GENERAL]),
linux-kernel@...r.kernel.org (open list)
Cc: Wander Lairson Costa <wander@...hat.com>,
Lucas Leong <wmliang@...osec.exchange>,
stable@...nel.org
Subject: [PATCH nf] netfilter/xt_sctp: validate the flag_info count
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")
Reported-by: Lucas Leong <wmliang@...osec.exchange>
Cc: stable@...nel.org
Signed-off-by: Wander Lairson Costa <wander@...hat.com>
---
net/netfilter/xt_sctp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/netfilter/xt_sctp.c b/net/netfilter/xt_sctp.c
index e8961094a282..b46a6a512058 100644
--- a/net/netfilter/xt_sctp.c
+++ b/net/netfilter/xt_sctp.c
@@ -149,6 +149,8 @@ static int sctp_mt_check(const struct xt_mtchk_param *par)
{
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)
--
2.41.0
Powered by blists - more mailing lists