[SRU][F/J/L][PATCH 1/1] netfilter: xt_sctp: validate the flag_info count

Magali Lemes magali.lemes at canonical.com
Thu Oct 26 14:15:24 UTC 2023


From: Wander Lairson Costa <wander at redhat.com>

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 at vger.kernel.org
Reported-by: Lucas Leong <wmliang at infosec.exchange>
Signed-off-by: Wander Lairson Costa <wander at redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
(cherry picked from commit e99476497687ef9e850748fe6d232264f30bc8f9)
CVE-2023-39193
Signed-off-by: Magali Lemes <magali.lemes at canonical.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 680015ba7cb6..d4bf089c9e3f 100644
--- a/net/netfilter/xt_sctp.c
+++ b/net/netfilter/xt_sctp.c
@@ -150,6 +150,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.34.1




More information about the kernel-team mailing list