All of
 help / color / mirror / Atom feed
From: Wander Lairson Costa <>
To: Pablo Neira Ayuso <>,
	Jozsef Kadlecsik <>,
	Florian Westphal <>,
	"David S. Miller" <>,
	Eric Dumazet <>,
	Jakub Kicinski <>, Paolo Abeni <>,
	Harald Welte <>, (open list:NETFILTER), (open list:NETFILTER), (open list:NETWORKING [GENERAL]), (open list)
Cc: Wander Lairson Costa <>,
	Lucas Leong <>,
Subject: [PATCH nf] netfilter/xt_sctp: validate the flag_info count
Date: Mon, 28 Aug 2023 19:12:55 -0300	[thread overview]
Message-ID: <> (raw)

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

Add the field validation in the checkentry function.

Fixes: 2e4e6a17af35 ("[NETFILTER] x_tables: Abstraction layer for {ip,ip6,arp}_tables")
Reported-by: Lucas Leong <>
Signed-off-by: Wander Lairson Costa <>
 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)

             reply	other threads:[~2023-08-28 22:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28 22:12 Wander Lairson Costa [this message]
2023-08-30 15:17 ` [PATCH nf] netfilter/xt_sctp: validate the flag_info count Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.